bug-gnulib
[Top][All Lists]
Advanced

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

[Bug-gnulib] use of strcoll


From: Bruno Haible
Subject: [Bug-gnulib] use of strcoll
Date: Tue, 31 Dec 2002 14:00:00 +0100 (CET)

Hi,

I made this change. The autoconf manual says that there are broken
implementations of strcoll() around. We should better avoid them.

Users of this file: You'll need to invoke AC_FUNC_STRCOLL.


2002-12-23  Bruno Haible  <address@hidden>

        * memcoll.c (STRCOLL): New macro.
        (memcoll): Use it.

diff -r -c3 gnulib-cvs/lib/memcoll.c gnulib/lib/memcoll.c
*** gnulib-cvs/lib/memcoll.c    2002-01-22 08:56:44.000000000 +0100
--- gnulib/lib/memcoll.c        2002-12-23 02:35:11.000000000 +0100
***************
*** 32,37 ****
--- 32,44 ----
  # include <string.h>
  #endif
  
+ /* Use strcoll() only if it really works.  */
+ #if HAVE_STRCOLL
+ # define STRCOLL strcoll
+ #else
+ # define STRCOLL strcmp
+ #endif
+ 
  /* Compare S1 (with length S1LEN) and S2 (with length S2LEN) according
     to the LC_COLLATE locale.  S1 and S2 do not overlap, and are not
     adjacent.  Temporarily modify the bytes after S1 and S2, but
***************
*** 47,53 ****
    s1[s1len++] = '\0';
    s2[s2len++] = '\0';
  
!   while (! (errno = 0, (diff = strcoll (s1, s2)) || errno))
      {
        /* strcoll found no difference, but perhaps it was fooled by NUL
         characters in the data.  Work around this problem by advancing
--- 54,60 ----
    s1[s1len++] = '\0';
    s2[s2len++] = '\0';
  
!   while (! (errno = 0, (diff = STRCOLL (s1, s2)) || errno))
      {
        /* strcoll found no difference, but perhaps it was fooled by NUL
         characters in the data.  Work around this problem by advancing



reply via email to

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