diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-01-21 02:52:59 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-01-21 02:52:59 +0000 |
commit | 3f1adc3da04a7809171c3990770d72f28c5d80e4 (patch) | |
tree | 0953b7f1ad2a4a72a3843ab34cc6b292e6d74ea5 /libc/misc | |
parent | 71486075e0ab506b80609416a3126a666b88e415 (diff) |
*: 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
Diffstat (limited to 'libc/misc')
-rw-r--r-- | libc/misc/ctype/ctype.c | 6 | ||||
-rw-r--r-- | libc/misc/locale/locale.c | 30 | ||||
-rw-r--r-- | libc/misc/wchar/wchar.c | 18 | ||||
-rw-r--r-- | libc/misc/wctype/_wctype.c | 20 |
4 files changed, 33 insertions, 41 deletions
diff --git a/libc/misc/ctype/ctype.c b/libc/misc/ctype/ctype.c index 8d20a39cf..a98d345d8 100644 --- a/libc/misc/ctype/ctype.c +++ b/libc/misc/ctype/ctype.c @@ -433,7 +433,7 @@ int isctype(int c, int mask) const __ctype_mask_t **__ctype_b_loc(void) { - return &(__UCLIBC_CURLOCALE_DATA).__ctype_b; + return &(__UCLIBC_CURLOCALE->__ctype_b); } libc_hidden_def(__ctype_b_loc) @@ -448,7 +448,7 @@ libc_hidden_def(__ctype_b_loc) /* libc_hidden_proto(__ctype_tolower_loc) */ const __ctype_touplow_t **__ctype_tolower_loc(void) { - return &(__UCLIBC_CURLOCALE_DATA).__ctype_tolower; + return &(__UCLIBC_CURLOCALE->__ctype_tolower); } libc_hidden_def(__ctype_tolower_loc) @@ -463,7 +463,7 @@ libc_hidden_def(__ctype_tolower_loc) /* libc_hidden_proto(__ctype_toupper_loc) */ const __ctype_touplow_t **__ctype_toupper_loc(void) { - return &(__UCLIBC_CURLOCALE_DATA).__ctype_toupper; + return &(__UCLIBC_CURLOCALE->__ctype_toupper); } libc_hidden_def(__ctype_toupper_loc) diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index a2a898fdd..ec6189279 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -340,7 +340,7 @@ static struct lconv the_lconv; struct lconv *localeconv(void) { register char *p = (char *) &the_lconv; - register char **q = (char **) &(__UCLIBC_CURLOCALE_DATA).decimal_point; + register char **q = (char **) &(__UCLIBC_CURLOCALE->decimal_point); do { *((char **)p) = *q; @@ -373,7 +373,7 @@ libc_hidden_def(localeconv) /* libc_hidden_proto(__ctype_toupper) */ #endif -__uclibc_locale_t __global_locale_data; +struct __uclibc_locale_struct __global_locale_data; __locale_t __global_locale = &__global_locale_data; @@ -881,12 +881,12 @@ void attribute_hidden _locale_init_l(__locale_t base) LC_ALL); ++base->category_item_count[0]; /* Increment for codeset entry. */ - base->category_offsets[0] = offsetof(__uclibc_locale_t, outdigit0_mb); - base->category_offsets[1] = offsetof(__uclibc_locale_t, decimal_point); - base->category_offsets[2] = offsetof(__uclibc_locale_t, int_curr_symbol); - base->category_offsets[3] = offsetof(__uclibc_locale_t, abday_1); -/* base->category_offsets[4] = offsetof(__uclibc_locale_t, collate???); */ - base->category_offsets[5] = offsetof(__uclibc_locale_t, yesexpr); + base->category_offsets[0] = offsetof(struct __uclibc_locale_struct, outdigit0_mb); + base->category_offsets[1] = offsetof(struct __uclibc_locale_struct, decimal_point); + base->category_offsets[2] = offsetof(struct __uclibc_locale_struct, int_curr_symbol); + base->category_offsets[3] = offsetof(struct __uclibc_locale_struct, abday_1); +/* base->category_offsets[4] = offsetof(struct __uclibc_locale_struct, collate???); */ + base->category_offsets[5] = offsetof(struct __uclibc_locale_struct, yesexpr); #ifdef __CTYPE_HAS_8_BIT_LOCALES base->tbl8ctype @@ -1321,7 +1321,7 @@ __locale_t newlocale(int category_mask, const char *locale, __locale_t base) } #else if (!base) { - base = malloc(sizeof(__uclibc_locale_t)); + base = malloc(sizeof(struct __uclibc_locale_struct)); if (base == NULL) return base; _locale_init_l(base); @@ -1352,12 +1352,12 @@ __locale_t duplocale(__locale_t dataset) assert(dataset != LC_GLOBAL_LOCALE); - if ((r = malloc(sizeof(__uclibc_locale_t))) != NULL) { - n = 2*dataset->collate.max_col_index+2; - if ((i2w = calloc(n, sizeof(uint16_t))) - != NULL - ) { - memcpy(r, dataset, sizeof(__uclibc_locale_t)); + r = malloc(sizeof(struct __uclibc_locale_struct)); + if (r != NULL) { + n = 2 * dataset->collate.max_col_index + 2; + i2w = calloc(n, sizeof(uint16_t)); + if (i2w != NULL) { + memcpy(r, dataset, sizeof(struct __uclibc_locale_struct)); r->collate.index2weight = i2w; memcpy(i2w, dataset->collate.index2weight, n * sizeof(uint16_t)); } else { diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c index 9bdaafe90..d921e4363 100644 --- a/libc/misc/wchar/wchar.c +++ b/libc/misc/wchar/wchar.c @@ -119,7 +119,7 @@ #endif #endif /* __UCLIBC_MJN3_ONLY__ */ -#define ENCODING ((__UCLIBC_CURLOCALE_DATA).encoding) +#define ENCODING (__UCLIBC_CURLOCALE->encoding) #define Cc2wc_IDX_SHIFT __LOCALE_DATA_Cc2wc_IDX_SHIFT #define Cc2wc_ROW_LEN __LOCALE_DATA_Cc2wc_ROW_LEN @@ -752,8 +752,8 @@ size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src, while (count) { if ((wc = ((unsigned char)(*s))) >= 0x80) { /* Non-ASCII... */ wc -= 0x80; - wc = __UCLIBC_CURLOCALE_DATA.tbl8c2wc[ - (__UCLIBC_CURLOCALE_DATA.idx8c2wc[wc >> Cc2wc_IDX_SHIFT] + wc = __UCLIBC_CURLOCALE->tbl8c2wc[ + (__UCLIBC_CURLOCALE->idx8c2wc[wc >> Cc2wc_IDX_SHIFT] << Cc2wc_IDX_SHIFT) + (wc & (Cc2wc_ROW_LEN - 1))]; if (!wc) { goto BAD; @@ -863,12 +863,12 @@ size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src, } else { u = 0; if (wc <= Cwc2c_DOMAIN_MAX) { - u = __UCLIBC_CURLOCALE_DATA.idx8wc2c[wc >> (Cwc2c_TI_SHIFT + u = __UCLIBC_CURLOCALE->idx8wc2c[wc >> (Cwc2c_TI_SHIFT + Cwc2c_TT_SHIFT)]; - u = __UCLIBC_CURLOCALE_DATA.tbl8wc2c[(u << Cwc2c_TI_SHIFT) + u = __UCLIBC_CURLOCALE->tbl8wc2c[(u << Cwc2c_TI_SHIFT) + ((wc >> Cwc2c_TT_SHIFT) & ((1 << Cwc2c_TI_SHIFT)-1))]; - u = __UCLIBC_CURLOCALE_DATA.tbl8wc2c[Cwc2c_TI_LEN + u = __UCLIBC_CURLOCALE->tbl8wc2c[Cwc2c_TI_LEN + (u << Cwc2c_TT_SHIFT) + (wc & ((1 << Cwc2c_TT_SHIFT)-1))]; } @@ -1468,7 +1468,7 @@ size_t weak_function iconv(iconv_t cd, char **__restrict inbuf, const __codeset_8_bit_t *c8b = __locale_mmap->codeset_8_bit + px->fromcodeset - 3; wc -= 0x80; - wc = __UCLIBC_CURLOCALE_DATA.tbl8c2wc[ + wc = __UCLIBC_CURLOCALE->tbl8c2wc[ (c8b->idx8c2wc[wc >> Cc2wc_IDX_SHIFT] << Cc2wc_IDX_SHIFT) + (wc & (Cc2wc_ROW_LEN - 1))]; if (!wc) { @@ -1553,10 +1553,10 @@ size_t weak_function iconv(iconv_t cd, char **__restrict inbuf, = __locale_mmap->codeset_8_bit + px->tocodeset - 3; __uwchar_t u; u = c8b->idx8wc2c[wc >> (Cwc2c_TI_SHIFT + Cwc2c_TT_SHIFT)]; - u = __UCLIBC_CURLOCALE_DATA.tbl8wc2c[(u << Cwc2c_TI_SHIFT) + u = __UCLIBC_CURLOCALE->tbl8wc2c[(u << Cwc2c_TI_SHIFT) + ((wc >> Cwc2c_TT_SHIFT) & ((1 << Cwc2c_TI_SHIFT)-1))]; - wc = __UCLIBC_CURLOCALE_DATA.tbl8wc2c[Cwc2c_TI_LEN + wc = __UCLIBC_CURLOCALE->tbl8wc2c[Cwc2c_TI_LEN + (u << Cwc2c_TT_SHIFT) + (wc & ((1 << Cwc2c_TT_SHIFT)-1))]; if (wc) { diff --git a/libc/misc/wctype/_wctype.c b/libc/misc/wctype/_wctype.c index c6f536d91..0f3201d49 100644 --- a/libc/misc/wctype/_wctype.c +++ b/libc/misc/wctype/_wctype.c @@ -123,12 +123,12 @@ enum { #endif #endif /* __UCLIBC_MJN3_ONLY__ */ -#define ENCODING ((__UCLIBC_CURLOCALE_DATA).encoding) +#define ENCODING (__UCLIBC_CURLOCALE->encoding) -#define WCctype ((__UCLIBC_CURLOCALE_DATA).tblwctype) -#define WCuplow ((__UCLIBC_CURLOCALE_DATA).tblwuplow) -#define WCcmob ((__UCLIBC_CURLOCALE_DATA).tblwcomb) -#define WCuplow_diff ((__UCLIBC_CURLOCALE_DATA).tblwuplow_diff) +#define WCctype (__UCLIBC_CURLOCALE->tblwctype) +#define WCuplow (__UCLIBC_CURLOCALE->tblwuplow) +#define WCcmob (__UCLIBC_CURLOCALE->tblwcomb) +#define WCuplow_diff (__UCLIBC_CURLOCALE->tblwuplow_diff) #define WC_TABLE_DOMAIN_MAX __LOCALE_DATA_WC_TABLE_DOMAIN_MAX @@ -256,9 +256,7 @@ ISW_FUNC_BODY(xdigit); #define TOWLOWER(w) towlower(w) #else /* L_towlower */ #define TOWLOWER(w) towlower_l(w, __locale_t locale) -#undef __UCLIBC_CURLOCALE_DATA #undef __UCLIBC_CURLOCALE -#define __UCLIBC_CURLOCALE_DATA (*locale) #define __UCLIBC_CURLOCALE (locale) #endif /* L_towlower */ @@ -363,9 +361,7 @@ libc_hidden_def(towlower) #define TOWUPPER(w) towupper(w) #else /* L_towupper */ #define TOWUPPER(w) towupper_l(w, __locale_t locale) -#undef __UCLIBC_CURLOCALE_DATA #undef __UCLIBC_CURLOCALE -#define __UCLIBC_CURLOCALE_DATA (*locale) #define __UCLIBC_CURLOCALE (locale) #endif /* L_towupper */ @@ -619,9 +615,7 @@ int iswctype(wint_t wc, wctype_t desc) #define ISWCTYPE(w,d) iswctype(w,d) #else /* L_iswctype */ #define ISWCTYPE(w,d) iswctype_l(w,d, __locale_t locale) -#undef __UCLIBC_CURLOCALE_DATA #undef __UCLIBC_CURLOCALE -#define __UCLIBC_CURLOCALE_DATA (*locale) #define __UCLIBC_CURLOCALE (locale) #endif /* L_iswctype */ @@ -668,7 +662,7 @@ int ISWCTYPE(wint_t wc, wctype_t desc) <= ctype_range[2*desc + 1] ) && ((desc != _CTYPE_iswblank) || (d & 1)); #else - return (__UCLIBC_CURLOCALE_DATA).code2flag[d] & desc2flag[desc]; + return __UCLIBC_CURLOCALE->code2flag[d] & desc2flag[desc]; #endif } @@ -728,9 +722,7 @@ wint_t towctrans(wint_t wc, wctrans_t desc) #define TOWCTRANS(w,d) towctrans(w,d) #else /* L_towctrans */ #define TOWCTRANS(w,d) towctrans_l(w,d, __locale_t locale) -#undef __UCLIBC_CURLOCALE_DATA #undef __UCLIBC_CURLOCALE -#define __UCLIBC_CURLOCALE_DATA (*locale) #define __UCLIBC_CURLOCALE (locale) #endif /* L_towctrans */ |