bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

strncasecmp declaration tweak


From: Bruno Haible
Subject: strncasecmp declaration tweak
Date: Mon, 5 Feb 2007 03:19:33 +0100
User-agent: KMail/1.5.4

This simplies a bit lib/string.h and adjusts the corresponding link warning.

2007-02-04  Bruno Haible  <address@hidden>

        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.

--- lib/string_.h       5 Feb 2007 01:57:07 -0000       1.11
+++ lib/string_.h       5 Feb 2007 02:10:01 -0000
@@ -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
 
--- m4/string_h.m4      5 Feb 2007 01:57:07 -0000       1.9
+++ m4/string_h.m4      5 Feb 2007 02:10:01 -0000
@@ -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])
--- modules/strcase     1 Feb 2007 00:29:52 -0000       1.11
+++ modules/strcase     5 Feb 2007 02:10:01 -0000
@@ -13,7 +13,6 @@
 
 configure.ac:
 gl_STRCASE
-gl_STRING_MODULE_INDICATOR([strcase])
 
 Makefile.am:
 
--- modules/string      5 Feb 2007 02:09:22 -0000       1.9
+++ modules/string      5 Feb 2007 02:10:02 -0000
@@ -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' \





reply via email to

[Prev in Thread] Current Thread [Next in Thread]