changeset 7936:b93a4036490a

Optimize the recognition of "UTF-8" strings.
author Bruno Haible <bruno@clisp.org>
date Wed, 24 Jan 2007 03:00:11 +0000
parents 6de574c3019f
children c9127d50c750
files ChangeLog lib/striconveh.c modules/striconveh
diffstat 3 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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.
--- a/lib/striconveh.c
+++ b/lib/striconveh.c
@@ -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 @@
       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 @@
 	    }
 	}
 
-      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 @@
       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 @@
 	    }
 	}
 
-      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
 	{
--- a/modules/striconveh
+++ b/modules/striconveh
@@ -14,6 +14,7 @@
 unistr/u8-mbtouc
 strdup
 c-strcase
+c-strcaseeq
 
 configure.ac:
 if test $gl_cond_libtool = false; then