Optimize the recognition of "UTF-8" strings.
authorBruno Haible <bruno@clisp.org>
Wed, 24 Jan 2007 03:00:11 +0000 (03:00 +0000)
committerBruno Haible <bruno@clisp.org>
Wed, 24 Jan 2007 03:00:11 +0000 (03:00 +0000)
ChangeLog
lib/striconveh.c
modules/striconveh

index c6bae0f0c6364bd07d21a68760f86c969c15ad22..54f93e4b81650d3c66d926ae4c4013a0e224f858 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-01-23  Bruno Haible  <bruno@clisp.org>
+
+       * lib/striconveh.c: Include c-strcaseeq.h.
+       (mem_iconveh, str_iconveh): Use STRCASEEQ instead of c_strcasecmp.
+       * modules/striconveh (Depends-on): Add c-strcaseeq.
+
 2007-01-23  Bruno Haible  <bruno@clisp.org>
 
        * MODULES.html.sh (String handling): Add streq, c-strcaseeq.
index 7feb768168da91d1589a8cd280f6ef845d975e30..c1ef0b1fd121c52f6bc7a6fba4483ab7c31ffd3f 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "strdup.h"
 #include "c-strcase.h"
+#include "c-strcaseeq.h"
 
 #ifndef SIZE_MAX
 # define SIZE_MAX ((size_t) -1)
@@ -929,7 +930,7 @@ mem_iconveh (const char *src, size_t srclen,
       if (cd == (iconv_t)(-1))
        return -1;
 
-      if (c_strcasecmp (from_codeset, "UTF-8") == 0)
+      if (STRCASEEQ (from_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0))
        cd1 = (iconv_t)(-1);
       else
        {
@@ -943,7 +944,7 @@ mem_iconveh (const char *src, size_t srclen,
            }
        }
 
-      if (c_strcasecmp (to_codeset, "UTF-8") == 0)
+      if (STRCASEEQ (to_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0))
        cd2 = (iconv_t)(-1);
       else
        {
@@ -1062,7 +1063,7 @@ str_iconveh (const char *src,
       if (cd == (iconv_t)(-1))
        return NULL;
 
-      if (c_strcasecmp (from_codeset, "UTF-8") == 0)
+      if (STRCASEEQ (from_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0))
        cd1 = (iconv_t)(-1);
       else
        {
@@ -1076,7 +1077,7 @@ str_iconveh (const char *src,
            }
        }
 
-      if (c_strcasecmp (to_codeset, "UTF-8") == 0)
+      if (STRCASEEQ (to_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0))
        cd2 = (iconv_t)(-1);
       else
        {
index e3649e08246d31dfb7cd41ae4ca52ab2fcecb0da..0aeca22a518f005107dcb87d156282ac719b49b4 100644 (file)
@@ -14,6 +14,7 @@ unistr/u8-prev
 unistr/u8-mbtouc
 strdup
 c-strcase
+c-strcaseeq
 
 configure.ac:
 if test $gl_cond_libtool = false; then