Hi Paul.

> Date: Wed, 26 Mar 2014 21:39:48 -0700
> From: Paul Eggert <[email protected]>
> To: Aharon Robbins <[email protected]>, [email protected]
>
> Aharon Robbins wrote:
> > we should be defining this as
> >
> >     # define setlocale(category, locale) ("C")
>
> Thanks, that sounds right.  I installed the attached patch.

Actually, after a night's sleep, I think that was wrong. What if
the system's setlocale() actually returns NULL?  I suggest
the below change to master.

Thanks,

Arnold
----------------------------------------------------------------
diff --git a/src/dfa.c b/src/dfa.c
index f88ff2a..0fd8944 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -37,7 +37,7 @@
 /* Gawk doesn't use Gnulib, so don't assume that setlocale and
    static_assert are present.  */
 #ifndef LC_ALL
-# define setlocale(category, locale) "C"
+# define setlocale(category, locale) NULL
 #endif
 #ifndef static_assert
 # define static_assert(cond, diagnostic) \
@@ -784,8 +784,9 @@ using_simple_locale (void)
       if (unibyte_c < 0)
         {
           char const *locale = setlocale (LC_ALL, NULL);
-          unibyte_c = (locale && (STREQ (locale, "C")
-                                  || STREQ (locale, "POSIX")));
+          unibyte_c = (locale == NULL
+                          || STREQ (locale, "C")
+                          || STREQ (locale, "POSIX"));
         }
       return unibyte_c;
     }



Reply via email to