diff options
author | Keith Packard <keithp@keithp.com> | 2018-09-05 21:39:40 -0700 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2018-09-06 14:19:53 +0200 |
commit | 77f8a6dfab98d8afd662c34ea832579f0565b40c (patch) | |
tree | ab4d3348ac068879aa4054a34d12b1008ab73aa9 /newlib/libc/locale | |
parent | 3b6994ec5f5fb47ba87fb3dae154cad21017b30d (diff) | |
download | newlib-77f8a6dfab98d8afd662c34ea832579f0565b40c.zip newlib-77f8a6dfab98d8afd662c34ea832579f0565b40c.tar.gz newlib-77f8a6dfab98d8afd662c34ea832579f0565b40c.tar.bz2 |
Use !__HAVE_LOCALE_INFO__ define to use _ctype_ directly [v2]
When __HAVE_LOCALE_INFO__ is not selected, directly access the
existing _ctype_ variable from __locale_ctype_ptr() and
__locale_ctype_ptr_l(), eliminating the need for any locale or reent
structure
Signed-off-by: Keith Packard <keithp@keithp.com>
v2:
locale: fix conflict with __locale_ctype_ptr macro
If we are building without __HAVE_LOCALE_INFO__, there is a
macro providing __locale_ctype_ptr which in turn fouls up this
declaration.
Signed-off-by: Michael Lyle <mlyle@lyle.org>
Diffstat (limited to 'newlib/libc/locale')
-rw-r--r-- | newlib/libc/locale/locale.c | 2 | ||||
-rw-r--r-- | newlib/libc/locale/setlocale.h | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c index 557982d..791a775 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -981,6 +981,7 @@ __locale_mb_cur_max (void) #endif } +#ifdef __HAVE_LOCALE_INFO__ const char * __locale_ctype_ptr_l (struct __locale_t *locale) { @@ -992,6 +993,7 @@ __locale_ctype_ptr (void) { return __get_current_locale ()->ctype_ptr; } +#endif /* __HAVE_LOCALE_INFO__ */ #ifndef _REENT_ONLY diff --git a/newlib/libc/locale/setlocale.h b/newlib/libc/locale/setlocale.h index 85a38d5..25c27cf 100644 --- a/newlib/libc/locale/setlocale.h +++ b/newlib/libc/locale/setlocale.h @@ -217,7 +217,11 @@ __get_global_locale () _ELIDABLE_INLINE struct __locale_t * __get_locale_r (struct _reent *r) { +#ifdef __HAVE_LOCALE_INFO__ return r->_locale; +#else + return __get_global_locale(); +#endif } /* In POSIX terms the current locale is the locale used by all functions @@ -227,7 +231,11 @@ __get_locale_r (struct _reent *r) _ELIDABLE_INLINE struct __locale_t * __get_current_locale (void) { +#ifdef __HAVE_LOCALE_INFO__ return _REENT->_locale ?: __get_global_locale (); +#else + return __get_global_locale(); +#endif } /* Only access fixed "C" locale using this function. Fake for !_MB_CAPABLE |