Mercurial > hg > octave-lojdl > gnulib-hg
changeset 8093:c3159b65e31c
Simplify handling of strncasecmp. Improve link warning.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 05 Feb 2007 02:15:46 +0000 |
parents | bdbd1a6a7a67 |
children | 8fc7f1000e84 |
files | ChangeLog lib/string_.h m4/string_h.m4 modules/strcase modules/string |
diffstat | 5 files changed, 17 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-02-04 Bruno Haible <bruno@clisp.org> + + 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 <bruno@clisp.org> New module mbscasecmp, reduced goal of strcasecmp.
--- a/lib/string_.h +++ b/lib/string_.h @@ -133,15 +133,16 @@ 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
--- a/m4/string_h.m4 +++ b/m4/string_h.m4 @@ -59,7 +59,6 @@ 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])
--- a/modules/strcase +++ b/modules/strcase @@ -13,7 +13,6 @@ configure.ac: gl_STRCASE -gl_STRING_MODULE_INDICATOR([strcase]) Makefile.am:
--- a/modules/string +++ b/modules/string @@ -30,7 +30,6 @@ -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' \