From: Bruno Haible Date: Mon, 5 Feb 2007 02:15:46 +0000 (+0000) Subject: Simplify handling of strncasecmp. Improve link warning. X-Git-Tag: cvs-readonly~1125 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=3e3363f6fe86a6b7cfe1f4a762a33eb961e0770a;p=gnulib.git Simplify handling of strncasecmp. Improve link warning. --- diff --git a/ChangeLog b/ChangeLog index 68d8616b7..6f50e0e1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2007-02-04 Bruno Haible + Simplify handling of strncasecmp. + * lib/string_.h (strncasecmp): Remove test for GNULIB_STRCASE. Change + the conditional link warning. + * m4/string_h.m4 (gl_STRING_MODULE_INDICATOR_DEFAULTS): Don't + initialize GNULIB_STRCASE. + * modules/strcase (configure.ac): Don't invoke + gl_STRING_MODULE_INDICATOR. + * modules/string (string.h): Don't substitute GNULIB_STRCASE. + +2007-02-04 Bruno Haible + New module mbscasecmp, reduced goal of strcasecmp. * modules/mbscasecmp: New file. * lib/mbscasecmp.c: New file, copied from lib/strcasecmp.c. diff --git a/lib/string_.h b/lib/string_.h index 59a14ca24..e1c0373e9 100644 --- a/lib/string_.h +++ b/lib/string_.h @@ -133,15 +133,16 @@ extern int strcasecmp (char const *s1, char const *s2); returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. Note: This function cannot work correctly in multibyte locales. */ -#if @GNULIB_STRCASE@ -# if ! @HAVE_DECL_STRNCASECMP@ -extern int strncasecmp (char const *__s1, char const *__s2, size_t __n); -# endif +#if ! @HAVE_DECL_STRNCASECMP@ +extern int strncasecmp (char const *s1, char const *s2, size_t n); #endif #if defined GNULIB_POSIXCHECK +/* strncasecmp() does not work with multibyte strings: + POSIX says that it operates on "strings", and "string" in POSIX is defined + as a sequence of bytes, not of characters. */ # undef strncasecmp # define strncasecmp(a,b) \ - (GL_LINK_WARNING ("strncasecmp cannot work correctly in multibyte locales - don't use it if you care about internationalization"), \ + (GL_LINK_WARNING ("strncasecmp cannot work correctly on character strings in multibyte locales - don't use it if you care about internationalization; use c_strncasecmp (from gnulib module c-strcase) if you want a locale independent function"), \ strncasecmp (a, b)) #endif diff --git a/m4/string_h.m4 b/m4/string_h.m4 index 8dfe95f0f..b68afc9a4 100644 --- a/m4/string_h.m4 +++ b/m4/string_h.m4 @@ -59,7 +59,6 @@ AC_DEFUN([gl_STRING_MODULE_INDICATOR_DEFAULTS], GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR]) GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY]) GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY]) - GNULIB_STRCASE=0; AC_SUBST([GNULIB_STRCASE]) GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL]) GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP]) GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP]) diff --git a/modules/strcase b/modules/strcase index 77d2f2c74..05c1c921c 100644 --- a/modules/strcase +++ b/modules/strcase @@ -13,7 +13,6 @@ string configure.ac: gl_STRCASE -gl_STRING_MODULE_INDICATOR([strcase]) Makefile.am: diff --git a/modules/string b/modules/string index 8e657257f..a2eab98f3 100644 --- a/modules/string +++ b/modules/string @@ -30,7 +30,6 @@ string.h: string_.h -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \ -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \ -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \ - -e 's|@''GNULIB_STRCASE''@|$(GNULIB_STRCASE)|g' \ -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \ -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \ -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \