From 38f9d6311a396cc851ee075124188fed64cdbefa Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 30 Mar 2008 18:56:58 +0200 Subject: [PATCH] Optimize conversion from UTF-8 to UTF-8//TRANSLIT. --- ChangeLog | 5 +++++ lib/striconveh.c | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76a695ff2..5df926741 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2008-03-30 Bruno Haible + * lib/striconveh.h (mem_iconveh, str_iconveh): Optimize the conversion + from UTF-8 to UTF-8//TRANSLIT in the same way as from UTF-8 to UTF-8. + +2008-03-30 Bruno Haible + Avoid failure when attempting to return empty iconv results on some platforms. * lib/striconveh.c (mem_cd_iconveh_internal): In the final memory diff --git a/lib/striconveh.c b/lib/striconveh.c index 761f3b115..685117f81 100644 --- a/lib/striconveh.c +++ b/lib/striconveh.c @@ -1017,7 +1017,11 @@ mem_iconveh (const char *src, size_t srclen, } } - if (STRCASEEQ (to_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0)) + if (STRCASEEQ (to_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0) +# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 || _LIBICONV_VERSION >= 0x0105 + || c_strcasecmp (to_codeset, "UTF-8//TRANSLIT") == 0 +# endif + ) cd2 = (iconv_t)(-1); else { @@ -1153,7 +1157,11 @@ str_iconveh (const char *src, } } - if (STRCASEEQ (to_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0)) + if (STRCASEEQ (to_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0) +# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 || _LIBICONV_VERSION >= 0x0105 + || c_strcasecmp (to_codeset, "UTF-8//TRANSLIT") == 0 +# endif + ) cd2 = (iconv_t)(-1); else { -- 2.11.0