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 c6bae0f..54f93e4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 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.
 
        * modules/c-strcaseeq: New file.
index 7feb768..c1ef0b1 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 e3649e0..0aeca22 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