From 721650c300117e56f2343c88e337d1d8bfef6e5d Mon Sep 17 00:00:00 2001 From: Emanuele Giaquinta Date: Sat, 6 Jan 2007 15:52:22 +0000 Subject: [PATCH] Simplify. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4403 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/core/recode.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/core/recode.c b/src/core/recode.c index 79dd5065..1cbf3a69 100644 --- a/src/core/recode.c +++ b/src/core/recode.c @@ -89,7 +89,6 @@ char *recode_in(const SERVER_REC *server, const char *str, const char *target) const char *to = NULL; char *translit_to = NULL; char *recoded = NULL; - char *tagtarget = NULL; gboolean term_is_utf8, str_is_utf8, translit, recode, autodetect; int len; int i; @@ -122,12 +121,11 @@ char *recode_in(const SERVER_REC *server, const char *str, const char *target) from = "UTF-8"; else { - if (server != NULL && target != NULL) - tagtarget = server->tag == NULL ? NULL : - g_strdup_printf("%s/%s", server->tag, target); - if (tagtarget != NULL) + if (server != NULL && server->tag != NULL && target != NULL) { + char *tagtarget = g_strdup_printf("%s/%s", server->tag, target); from = iconfig_get_str("conversions", tagtarget, NULL); - g_free(tagtarget); + g_free(tagtarget); + } if (target != NULL && from == NULL) from = iconfig_get_str("conversions", target, NULL); @@ -186,14 +184,12 @@ char *recode_out(const SERVER_REC *server, const char *str, const char *target) if (target) { const char *to = NULL; char *translit_to = NULL; - char *tagtarget = NULL; - if (server != NULL && target != NULL) - tagtarget = server->tag == NULL ? NULL : - g_strdup_printf("%s/%s", server->tag, target); - if (tagtarget != NULL) + if (server != NULL && server->tag != NULL && target != NULL) { + char *tagtarget = g_strdup_printf("%s/%s", server->tag, target); to = iconfig_get_str("conversions", tagtarget, NULL); - g_free(tagtarget); + g_free(tagtarget); + } if (to == NULL || *to == '\0') to = iconfig_get_str("conversions", target, NULL); if ((to == NULL || *to == '\0') && server != NULL)