repairs for when set_locale() always return NULL

... as it does on Android
This commit is contained in:
Matthew Flatt 2013-05-01 10:19:57 -06:00
parent ae570e843e
commit 93b1f3ef2c

View File

@ -27,6 +27,11 @@
#include "schvers.h" #include "schvers.h"
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#ifdef NO_ERRNO_GLOBAL
# define errno -1
#else
# include <errno.h>
#endif
#ifndef DONT_USE_LOCALE #ifndef DONT_USE_LOCALE
# include <locale.h> # include <locale.h>
# ifdef MZ_NO_ICONV # ifdef MZ_NO_ICONV
@ -38,7 +43,6 @@
# endif # endif
# include <wchar.h> # include <wchar.h>
# include <wctype.h> # include <wctype.h>
# include <errno.h>
# ifdef MACOS_UNICODE_SUPPORT # ifdef MACOS_UNICODE_SUPPORT
# include <CoreFoundation/CFString.h> # include <CoreFoundation/CFString.h>
# include <CoreFoundation/CFLocale.h> # include <CoreFoundation/CFLocale.h>
@ -3847,7 +3851,7 @@ char *scheme_push_c_numeric_locale()
#ifndef DONT_USE_LOCALE #ifndef DONT_USE_LOCALE
GC_CAN_IGNORE char *prev; GC_CAN_IGNORE char *prev;
prev = setlocale(LC_NUMERIC, NULL); prev = setlocale(LC_NUMERIC, NULL);
if (!strcmp(prev, "C")) if (!prev || !strcmp(prev, "C"))
return NULL; return NULL;
else else
return setlocale(LC_NUMERIC, "C"); return setlocale(LC_NUMERIC, "C");