From 3f1adc3da04a7809171c3990770d72f28c5d80e4 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Wed, 21 Jan 2009 02:52:59 +0000 Subject: *: remove __UCLIBC_CURLOCALE_DATA, __UCLIBC_CURLOCALE_DATA.x is always equivalent to __UCLIBC_CURLOCALE->x. remove typedef __uclibc_locale_t, it used only in a few places, it is lees confusing to use struct __uclibc_locale_struct everywhere. xlocale.h: hide __global_locale back under _LIBC, bug 53 is wrong in claiming it should be exported. Also hide under _LIBC: extern __locale_t __curlocale_var; extern __locale_t __curlocale(void); extern __locale_t __curlocale_set(__locale_t newloc); # define __UCLIBC_CURLOCALE # define __XL_NPP(N) # define __LOCALE_PARAM # define __LOCALE_ARG # define __LOCALE_PTR --- libc/stdio/_fpmaxtostr.c | 12 ++++++------ libc/stdio/_scanf.c | 16 ++++++++-------- libc/stdio/_uintmaxtostr.c | 26 +++++++++++++------------- libc/stdio/_vfprintf.c | 6 +++--- 4 files changed, 30 insertions(+), 30 deletions(-) (limited to 'libc/stdio') diff --git a/libc/stdio/_fpmaxtostr.c b/libc/stdio/_fpmaxtostr.c index b8d93a091..0aab23364 100644 --- a/libc/stdio/_fpmaxtostr.c +++ b/libc/stdio/_fpmaxtostr.c @@ -501,8 +501,8 @@ ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, const char *p; if (PRINT_INFO_FLAG_VAL(info,group) - && *(p = __UCLIBC_CURLOCALE_DATA.grouping) - ) { + && *(p = __UCLIBC_CURLOCALE->grouping) + ) { int nblk1; nblk2 = nblk1 = *p; @@ -522,8 +522,8 @@ ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, tslen = 1; } else { #endif /* __UCLIBC_HAS_WCHAR__ */ - ts = __UCLIBC_CURLOCALE_DATA.thousands_sep; - tslen = __UCLIBC_CURLOCALE_DATA.thousands_sep_len; + ts = __UCLIBC_CURLOCALE->thousands_sep; + tslen = __UCLIBC_CURLOCALE->thousands_sep_len; #ifdef __UCLIBC_HAS_WCHAR__ } #endif /* __UCLIBC_HAS_WCHAR__ */ @@ -576,8 +576,8 @@ ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, ppc[2] = (intptr_t)(fmt + DECPT_OFFSET); } else { #endif /* __UCLIBC_HAS_WCHAR__ */ - ppc[1] = __UCLIBC_CURLOCALE_DATA.decimal_point_len; - ppc[2] = (intptr_t)(__UCLIBC_CURLOCALE_DATA.decimal_point); + ppc[1] = __UCLIBC_CURLOCALE->decimal_point_len; + ppc[2] = (intptr_t)(__UCLIBC_CURLOCALE->decimal_point); #ifdef __UCLIBC_HAS_WCHAR__ } #endif /* __UCLIBC_HAS_WCHAR__ */ diff --git a/libc/stdio/_scanf.c b/libc/stdio/_scanf.c index 1fa6208d4..9189a52e1 100644 --- a/libc/stdio/_scanf.c +++ b/libc/stdio/_scanf.c @@ -717,26 +717,26 @@ void attribute_hidden __init_scan_cookie(register struct scan_cookie *sc, #endif /* __UCLIBC_HAS_WCHAR__ */ #ifdef __UCLIBC_HAS_GLIBC_DIGIT_GROUPING__ - if (*(sc->grouping = __UCLIBC_CURLOCALE_DATA.grouping)) { - sc->thousands_sep = (const unsigned char *) __UCLIBC_CURLOCALE_DATA.thousands_sep; - sc->tslen = __UCLIBC_CURLOCALE_DATA.thousands_sep_len; + if (*(sc->grouping = __UCLIBC_CURLOCALE->grouping)) { + sc->thousands_sep = (const unsigned char *) __UCLIBC_CURLOCALE->thousands_sep; + sc->tslen = __UCLIBC_CURLOCALE->thousands_sep_len; #ifdef __UCLIBC_HAS_WCHAR__ - sc->thousands_sep_wc = __UCLIBC_CURLOCALE_DATA.thousands_sep_wc; + sc->thousands_sep_wc = __UCLIBC_CURLOCALE->thousands_sep_wc; #endif /* __UCLIBC_HAS_WCHAR__ */ } #endif /* __UCLIBC_HAS_GLIBC_DIGIT_GROUPING__ */ #ifdef __UCLIBC_HAS_FLOATS__ #ifdef __UCLIBC_HAS_LOCALE__ - sc->decpt = (const unsigned char *) __UCLIBC_CURLOCALE_DATA.decimal_point; - sc->decpt_len = __UCLIBC_CURLOCALE_DATA.decimal_point_len; + sc->decpt = (const unsigned char *) __UCLIBC_CURLOCALE->decimal_point; + sc->decpt_len = __UCLIBC_CURLOCALE->decimal_point_len; #else /* __UCLIBC_HAS_LOCALE__ */ sc->fake_decpt = sc->decpt = (unsigned char *) decpt_str; sc->decpt_len = 1; #endif /* __UCLIBC_HAS_LOCALE__ */ #ifdef __UCLIBC_HAS_WCHAR__ #ifdef __UCLIBC_HAS_LOCALE__ - sc->decpt_wc = __UCLIBC_CURLOCALE_DATA.decimal_point_wc; + sc->decpt_wc = __UCLIBC_CURLOCALE->decimal_point_wc; #else sc->decpt_wc = '.'; #endif @@ -1193,7 +1193,7 @@ int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg) #if defined(__UCLIBC_HAS_LOCALE__) && !defined(L_vfwscanf) /* ANSI/ISO C99 requires format string to be a valid multibyte string * beginning and ending in its initial shift state. */ - if (((__UCLIBC_CURLOCALE_DATA).encoding) != __ctype_encoding_7_bit) { + if (__UCLIBC_CURLOCALE->encoding != __ctype_encoding_7_bit) { const char *p = format; mbstate.__mask = 0; /* Initialize the mbstate. */ if (mbsrtowcs(NULL, &p, SIZE_MAX, &mbstate) == ((size_t)(-1))) { diff --git a/libc/stdio/_uintmaxtostr.c b/libc/stdio/_uintmaxtostr.c index 0d25a0a9f..086f6abd1 100644 --- a/libc/stdio/_uintmaxtostr.c +++ b/libc/stdio/_uintmaxtostr.c @@ -50,7 +50,7 @@ char attribute_hidden *_uintmaxtostr(register char * __restrict bufend, uintmax_ alphacase ^= outdigit; if (alphacase == __UIM_GROUP) { assert(base == 10); - if (*(g = __UCLIBC_CURLOCALE_DATA.grouping)) { + if (*(g = __UCLIBC_CURLOCALE->grouping)) { grouping = *g; } } @@ -62,9 +62,9 @@ char attribute_hidden *_uintmaxtostr(register char * __restrict bufend, uintmax_ do { #ifndef __LOCALE_C_ONLY if (!grouping) { /* Finished a group. */ - bufend -= __UCLIBC_CURLOCALE_DATA.thousands_sep_len; - memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, - __UCLIBC_CURLOCALE_DATA.thousands_sep_len); + bufend -= __UCLIBC_CURLOCALE->thousands_sep_len; + memcpy(bufend, __UCLIBC_CURLOCALE->thousands_sep, + __UCLIBC_CURLOCALE->thousands_sep_len); if (g[1] != 0) { /* g[1] == 0 means repeat last grouping. */ /* Note: g[1] == -1 means no further grouping. But since * we'll never wrap around, we can set grouping to -1 without @@ -80,10 +80,10 @@ char attribute_hidden *_uintmaxtostr(register char * __restrict bufend, uintmax_ #ifndef __LOCALE_C_ONLY if (unlikely(outdigit)) { - bufend -= __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]; + bufend -= __UCLIBC_CURLOCALE->outdigit_length[digit]; memcpy(bufend, - (&__UCLIBC_CURLOCALE_DATA.outdigit0_mb)[digit], - __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]); + (&__UCLIBC_CURLOCALE->outdigit0_mb)[digit], + __UCLIBC_CURLOCALE->outdigit_length[digit]); } else #endif { @@ -105,9 +105,9 @@ char attribute_hidden *_uintmaxtostr(register char * __restrict bufend, uintmax_ do { #ifndef __LOCALE_C_ONLY if (!grouping) { /* Finished a group. */ - bufend -= __UCLIBC_CURLOCALE_DATA.thousands_sep_len; - memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, - __UCLIBC_CURLOCALE_DATA.thousands_sep_len); + bufend -= __UCLIBC_CURLOCALE->thousands_sep_len; + memcpy(bufend, __UCLIBC_CURLOCALE->thousands_sep, + __UCLIBC_CURLOCALE->thousands_sep_len); if (g[1] != 0) { /* g[1] == 0 means repeat last grouping. */ /* Note: g[1] == -1 means no further grouping. But since * we'll never wrap around, we can set grouping to -1 without @@ -132,10 +132,10 @@ char attribute_hidden *_uintmaxtostr(register char * __restrict bufend, uintmax_ #ifndef __LOCALE_C_ONLY if (unlikely(outdigit)) { - bufend -= __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]; + bufend -= __UCLIBC_CURLOCALE->outdigit_length[digit]; memcpy(bufend, - (&__UCLIBC_CURLOCALE_DATA.outdigit0_mb)[digit], - __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]); + (&__UCLIBC_CURLOCALE->outdigit0_mb)[digit], + __UCLIBC_CURLOCALE->outdigit_length[digit]); } else #endif { diff --git a/libc/stdio/_vfprintf.c b/libc/stdio/_vfprintf.c index 850c83486..c9d0f6bb9 100644 --- a/libc/stdio/_vfprintf.c +++ b/libc/stdio/_vfprintf.c @@ -525,7 +525,7 @@ int attribute_hidden _ppfs_init(register ppfs_t *ppfs, const char *fmt0) #endif #ifdef __UCLIBC_HAS_LOCALE__ /* To support old programs, don't check mb validity if in C locale. */ - if (((__UCLIBC_CURLOCALE_DATA).encoding) != __ctype_encoding_7_bit) { + if (__UCLIBC_CURLOCALE->encoding != __ctype_encoding_7_bit) { /* ANSI/ISO C99 requires format string to be a valid multibyte string * beginning and ending in its initial shift state. */ static const char invalid_mbs[] = "Invalid multibyte format string."; @@ -1314,11 +1314,11 @@ static size_t _fp_out_wide(FILE *fp, intptr_t type, intptr_t len, intptr_t buf) #ifdef __UCLIBC_HAS_GLIBC_DIGIT_GROUPING__ if (s[i] == ',') { - wbuf[i] = __UCLIBC_CURLOCALE_DATA.thousands_sep_wc; + wbuf[i] = __UCLIBC_CURLOCALE->thousands_sep_wc; } else #endif /* __UCLIBC_HAS_GLIBC_DIGIT_GROUPING__ */ if (s[i] == '.') { - wbuf[i] = __UCLIBC_CURLOCALE_DATA.decimal_point_wc; + wbuf[i] = __UCLIBC_CURLOCALE->decimal_point_wc; } else { wbuf[i] = s[i]; } -- cgit v1.2.3