summaryrefslogtreecommitdiffstats
path: root/newlib/libc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2016-07-22 22:40:45 +0200
committerCorinna Vinschen <corinna@vinschen.de>2016-08-15 10:56:57 +0200
commitd4f6cae9cd526290bfa2a0be7d3dc9fd20f31dba (patch)
treef2217b863d7a82123182bafb966469ca5bb97fb6 /newlib/libc
parent53f84bb5ac76d95bbc5267596994119112e1a49b (diff)
downloadcygnal-d4f6cae9cd526290bfa2a0be7d3dc9fd20f31dba.tar.gz
cygnal-d4f6cae9cd526290bfa2a0be7d3dc9fd20f31dba.tar.bz2
cygnal-d4f6cae9cd526290bfa2a0be7d3dc9fd20f31dba.zip
Use __get_global_locale function where appropriate
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/locale/locale.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c
index c9f4bedb0..35c5e6c6f 100644
--- a/newlib/libc/locale/locale.c
+++ b/newlib/libc/locale/locale.c
@@ -296,13 +296,14 @@ _DEFUN(_setlocale_r, (p, category, locale),
}
if (locale == NULL)
- return category != LC_ALL ? __global_locale.categories[category] : currentlocale();
+ return category != LC_ALL ? __get_global_locale ()->categories[category]
+ : currentlocale();
/*
* Default to the current locale for everything.
*/
for (i = 1; i < _LC_LAST; ++i)
- strcpy (new_categories[i], __global_locale.categories[i]);
+ strcpy (new_categories[i], __get_global_locale ()->categories[i]);
/*
* Now go fill up new_categories from the locale argument
@@ -395,7 +396,7 @@ _DEFUN(_setlocale_r, (p, category, locale),
for (i = 1; i < _LC_LAST; ++i)
{
- strcpy (saved_categories[i], __global_locale.categories[i]);
+ strcpy (saved_categories[i], __get_global_locale ()->categories[i]);
if (loadlocale (__get_global_locale (), i, new_categories[i]) == NULL)
{
saverr = p->_errno;
@@ -421,20 +422,23 @@ _DEFUN(_setlocale_r, (p, category, locale),
static char *
currentlocale ()
{
- int i;
-
- (void)strcpy(global_locale_string, __global_locale.categories[1]);
-
- for (i = 2; i < _LC_LAST; ++i)
- if (strcmp(__global_locale.categories[1], __global_locale.categories[i])) {
- for (i = 2; i < _LC_LAST; ++i) {
- (void)strcat(global_locale_string, "/");
- (void)strcat(global_locale_string,
- __global_locale.categories[i]);
- }
- break;
- }
- return (global_locale_string);
+ int i;
+
+ strcpy (global_locale_string, __get_global_locale ()->categories[1]);
+
+ for (i = 2; i < _LC_LAST; ++i)
+ if (strcmp (__get_global_locale ()->categories[1],
+ __get_global_locale ()->categories[i]))
+ {
+ for (i = 2; i < _LC_LAST; ++i)
+ {
+ (void)strcat(global_locale_string, "/");
+ (void)strcat(global_locale_string,
+ __get_global_locale ()->categories[i]);
+ }
+ break;
+ }
+ return global_locale_string;
}
extern void __set_ctype (struct __locale_t *, const char *charset);
@@ -943,7 +947,7 @@ _DEFUN_VOID (__locale_mb_cur_max)
#ifdef __HAVE_LOCALE_INFO__
return __get_current_ctype_locale ()->mb_cur_max[0];
#else
- return __global_locale.mb_cur_max[0];
+ return __get_global_locale ()->mb_cur_max[0];
#endif
}