public inbox for newlib-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] setlocale.h: Fix current locale handling for !__HAVE_LOCALE_INFO__ targets Date: Mon, 15 Aug 2016 09:27:00 -0000 [thread overview] Message-ID: <20160815092721.71397.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=1a5d08014b88f2cdc8fa2b3434edfb582d08716a commit 1a5d08014b88f2cdc8fa2b3434edfb582d08716a Author: Corinna Vinschen <corinna@vinschen.de> Date: Thu Jul 28 09:50:43 2016 +0200 setlocale.h: Fix current locale handling for !__HAVE_LOCALE_INFO__ targets Signed-off by: Corinna Vinschen <corinna@vinschen.de> Diff: --- newlib/libc/include/ctype.h | 5 ----- newlib/libc/locale/locale.c | 4 +--- newlib/libc/locale/setlocale.h | 26 +++++++++++++------------- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/newlib/libc/include/ctype.h b/newlib/libc/include/ctype.h index 0284c18..d34b8e5 100644 --- a/newlib/libc/include/ctype.h +++ b/newlib/libc/include/ctype.h @@ -69,13 +69,8 @@ extern int toascii_l (int __c, locale_t __l); #ifndef _MB_CAPABLE _CONST #endif -#ifdef __HAVE_LOCALE_INFO__ char *__locale_ctype_ptr (void); # define __CTYPE_PTR (__locale_ctype_ptr ()) -#else -extern __IMPORT char *__ctype_ptr__; -# define __CTYPE_PTR (__ctype_ptr__) -#endif #ifndef __cplusplus /* These macros are intentionally written in a manner that will trigger diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c index 3409a7b..c1970f9 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -978,11 +978,10 @@ _DEFUN_VOID (__locale_mb_cur_max) #ifdef __HAVE_LOCALE_INFO__ return __get_current_ctype_locale ()->mb_cur_max[0]; #else - return __get_global_locale ()->mb_cur_max[0]; + return __get_current_locale ()->mb_cur_max[0]; #endif } -#ifdef __HAVE_LOCALE_INFO__ char * _DEFUN_VOID (__locale_ctype_ptr) { @@ -992,7 +991,6 @@ _DEFUN_VOID (__locale_ctype_ptr) return __get_locale_r (_REENT) ? __get_locale_r (_REENT)->ctype_ptr : __ctype_ptr__; } -#endif char * __locale_ctype_ptr_l (struct __locale_t *locale) diff --git a/newlib/libc/locale/setlocale.h b/newlib/libc/locale/setlocale.h index 5dcfe88..b528ab9 100644 --- a/newlib/libc/locale/setlocale.h +++ b/newlib/libc/locale/setlocale.h @@ -242,12 +242,21 @@ __get_current_collate_locale (void) } #endif +#ifdef __HAVE_LOCALE_INFO__ _ELIDABLE_INLINE const struct lc_ctype_T * __get_ctype_locale (struct __locale_t *locale) { return (const struct lc_ctype_T *) (locale)->lc_cat[LC_CTYPE].ptr; } +_ELIDABLE_INLINE const struct lc_ctype_T * +__get_current_ctype_locale (void) +{ + return (const struct lc_ctype_T *) + __get_current_locale ()->lc_cat[LC_CTYPE].ptr; +} +#endif + _ELIDABLE_INLINE int __locale_mb_cur_max_l (struct __locale_t *locale) { @@ -258,13 +267,7 @@ __locale_mb_cur_max_l (struct __locale_t *locale) #endif } -_ELIDABLE_INLINE const struct lc_ctype_T * -__get_current_ctype_locale (void) -{ - return (const struct lc_ctype_T *) - __get_current_locale ()->lc_cat[LC_CTYPE].ptr; -} - +#ifdef __HAVE_LOCALE_INFO__ _ELIDABLE_INLINE const struct lc_monetary_T * __get_monetary_locale (struct __locale_t *locale) { @@ -316,6 +319,7 @@ __get_current_messages_locale (void) return (const struct lc_messages_T *) __get_current_locale ()->lc_cat[LC_MESSAGES].ptr; } +#endif _ELIDABLE_INLINE const char * __locale_charset (void) @@ -323,7 +327,7 @@ __locale_charset (void) #ifdef __HAVE_LOCALE_INFO__ return __get_current_ctype_locale ()->codeset; #else - return __global_locale.ctype_codeset; + return __get_current_locale ()->ctype_codeset; #endif } @@ -333,18 +337,14 @@ __locale_msgcharset (void) #ifdef __HAVE_LOCALE_INFO__ return (char *) __get_current_messages_locale ()->codeset; #else - return (char *) __global_locale.message_codeset; + return (char *) __get_current_locale ()->message_codeset; #endif } _ELIDABLE_INLINE int __locale_cjk_lang (void) { -#ifdef __HAVE_LOCALE_INFO__ return __get_current_locale ()->cjk_lang; -#else - return __global_locale.cjk_lang; -#endif } int __ctype_load_locale (struct __locale_t *, const char *, void *,
reply other threads:[~2016-08-15 9:27 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20160815092721.71397.qmail@sourceware.org \ --to=corinna@sourceware.org \ --cc=newlib-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).