[PATCH 2/3] Remove direct locale access from other files
Jaap de Wolff
info@jasoon.nl
Fri Feb 16 18:46:00 GMT 2018
---
newlib/libc/ctype/tolower_l.c | 4 ++--
newlib/libc/ctype/toupper_l.c | 4 ++--
newlib/libc/time/strftime.c | 4 ++--
newlib/libc/time/strptime.c | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/newlib/libc/ctype/tolower_l.c b/newlib/libc/ctype/tolower_l.c
index 3b196c8d2..8d6134959 100644
--- a/newlib/libc/ctype/tolower_l.c
+++ b/newlib/libc/ctype/tolower_l.c
@@ -23,8 +23,8 @@ tolower_l (int c, struct __locale_t *locale)
mbstate_t state;
memset (&state, 0, sizeof state);
- if (locale->mbtowc (_REENT, &wc, s, 1, &state) >= 0
- && locale->wctomb (_REENT, s,
+ if (_locale_mbtowc (locale, _REENT, &wc, s, 1, &state) >= 0
+ && _locale_wctomb (locale, _REENT, s,
(wchar_t) towlower_l ((wint_t) wc, locale),
&state) == 1)
c = (unsigned char) s[0];
diff --git a/newlib/libc/ctype/toupper_l.c b/newlib/libc/ctype/toupper_l.c
index b126c1e28..95dded7da 100644
--- a/newlib/libc/ctype/toupper_l.c
+++ b/newlib/libc/ctype/toupper_l.c
@@ -25,8 +25,8 @@ toupper_l (int c, struct __locale_t *locale)
mbstate_t state;
memset (&state, 0, sizeof state);
- if (locale->mbtowc (_REENT, &wc, s, 1, &state) >= 0
- && locale->wctomb (_REENT, s,
+ if (_locale_mbtowc (locale, _REENT, &wc, s, 1, &state) >= 0
+ && _locale_wctomb (locale, _REENT, s,
(wchar_t) towupper_l ((wint_t) wc, locale),
&state) == 1)
c = (unsigned char) s[0];
diff --git a/newlib/libc/time/strftime.c b/newlib/libc/time/strftime.c
index 3e5e268bc..ef140b688 100644
--- a/newlib/libc/time/strftime.c
+++ b/newlib/libc/time/strftime.c
@@ -1438,7 +1438,7 @@ strftime (CHAR *__restrict s,
#ifdef _WANT_C99_TIME_FORMATS
era_info_t *era_info = NULL;
alt_digits_t *alt_digits = NULL;
- size_t ret = __strftime (s, maxsize, format, tim_p, __get_current_locale (),
+ size_t ret = __strftime (s, maxsize, format, tim_p, __CURRENT_LOCALE,
&era_info, &alt_digits);
if (era_info)
free_era_info (era_info);
@@ -1446,7 +1446,7 @@ strftime (CHAR *__restrict s,
free_alt_digits (alt_digits);
return ret;
#else /* !_WANT_C99_TIME_FORMATS */
- return __strftime (s, maxsize, format, tim_p, __get_current_locale (),
+ return __strftime (s, maxsize, format, tim_p, __CURRENT_LOCALE,
NULL, NULL);
#endif /* !_WANT_C99_TIME_FORMATS */
}
diff --git a/newlib/libc/time/strptime.c b/newlib/libc/time/strptime.c
index 12b2ef469..d70520611 100644
--- a/newlib/libc/time/strptime.c
+++ b/newlib/libc/time/strptime.c
@@ -505,5 +505,5 @@ strptime_l (const char *buf, const char *format, struct tm *timeptr,
char *
strptime (const char *buf, const char *format, struct tm *timeptr)
{
- return strptime_l (buf, format, timeptr, __get_current_locale ());
+ return strptime_l (buf, format, timeptr, __CURRENT_LOCALE);
}
--
2.11.0
More information about the Newlib
mailing list