bug-coreutils
[Top][All Lists]
Advanced

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

c-strtod.c patch for non-glibc mixed-locale encodings


From: Paul Eggert
Subject: c-strtod.c patch for non-glibc mixed-locale encodings
Date: Wed, 08 Sep 2004 10:18:39 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

I installed this obvious little patch in both gnulib and coreutils:

2004-09-08  Paul Eggert  <address@hidden>

        * c-strtod.c (C_STRTOD) [!defined LC_ALL_MASK]: Set LC_ALL to "C",
        not just LC_NUMERIC, to avoid the unlikely possibility of mixed
        locales screwing things up.  This removes an inconsistency with
        the LC_ALL_MASK case.

Index: c-strtod.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/c-strtod.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -p -u -r1.1 -r1.2
--- c-strtod.c  5 Aug 2004 23:27:27 -0000       1.1
+++ c-strtod.c  8 Sep 2004 17:16:57 -0000       1.2
@@ -59,19 +59,19 @@ C_STRTOD (char const *nptr, char **endpt
 
 #else
 
-  char *saved_locale = setlocale (LC_NUMERIC, NULL);
+  char *saved_locale = setlocale (LC_ALL, NULL);
 
   if (saved_locale)
     {
       saved_locale = xstrdup (saved_locale);
-      setlocale (LC_NUMERIC, "C");
+      setlocale (LC_ALL, "C");
     }
 
   r = STRTOD (nptr, endptr);
 
   if (saved_locale)
     {
-      setlocale (LC_NUMERIC, saved_locale);
+      setlocale (LC_ALL, saved_locale);
       free (saved_locale);
     }
 




reply via email to

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