From beabf82ddfc2d755b04f84cf3e8b96fbcfea9ea7 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 12 Nov 2008 15:16:01 +0100 Subject: [PATCH] draw: check more quickly if we need UTF-8 conversion Signed-off-by: Julien Danjou --- draw.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/draw.c b/draw.c index b1680145..e21e415c 100644 --- a/draw.c +++ b/draw.c @@ -47,11 +47,12 @@ draw_iso2utf8(const char *iso, size_t len) size_t utf8len; char *utf8, *utf8p; static iconv_t iso2utf8 = (iconv_t) -1; + static int8_t dont_need_convert = -1; - if(!len) - return NULL; + if(dont_need_convert == -1) + dont_need_convert = !a_strcmp(nl_langinfo(CODESET), "UTF-8"); - if(!a_strcmp(nl_langinfo(CODESET), "UTF-8")) + if(!len || dont_need_convert) return NULL; if(iso2utf8 == (iconv_t) -1)