# HG changeset patch # User Bruno Haible # Date 1169607611 0 # Node ID b93a4036490ac0416c7fd6088400054c8b3a3735 # Parent 6de574c3019fbe9a9a8dfbf920729437c6e2d363 Optimize the recognition of "UTF-8" strings. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-01-23 Bruno Haible + + * 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 * MODULES.html.sh (String handling): Add streq, c-strcaseeq. diff --git a/lib/striconveh.c b/lib/striconveh.c --- 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 { diff --git a/modules/striconveh b/modules/striconveh --- 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