svn commit: branches/uClibc-nptl: include libc/misc/ctype libc/misc/locale etc...

vda at uclibc.org vda at uclibc.org
Wed Jan 21 02:53:21 UTC 2009


Author: vda
Date: 2009-01-21 02:53:20 +0000 (Wed, 21 Jan 2009)
New Revision: 24935

Log:
*: 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



Modified:
   branches/uClibc-nptl/include/xlocale.h
   branches/uClibc-nptl/libc/misc/ctype/ctype.c
   branches/uClibc-nptl/libc/misc/locale/locale.c
   branches/uClibc-nptl/libc/misc/wchar/wchar.c
   branches/uClibc-nptl/libc/misc/wctype/_wctype.c
   branches/uClibc-nptl/libc/stdio/_fpmaxtostr.c
   branches/uClibc-nptl/libc/stdio/_scanf.c
   branches/uClibc-nptl/libc/stdio/_uintmaxtostr.c
   branches/uClibc-nptl/libc/stdio/_vfprintf.c
   branches/uClibc-nptl/libc/stdlib/stdlib.c
   branches/uClibc-nptl/libc/string/_collate.c
   branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_locale.h


Changeset:
Modified: branches/uClibc-nptl/include/xlocale.h
===================================================================
--- branches/uClibc-nptl/include/xlocale.h	2009-01-21 02:52:59 UTC (rev 24934)
+++ branches/uClibc-nptl/include/xlocale.h	2009-01-21 02:53:20 UTC (rev 24935)
@@ -50,7 +50,7 @@
   const __ctype_touplow_t *__ctype_tolower;
   const __ctype_touplow_t *__ctype_toupper;
 
-  __uclibc_locale_t *__locale_ptr;
+  struct __uclibc_locale_struct *__locale_ptr;
 
 #if 0
   /* Note: LC_ALL is not a valid index into this array.  */

Modified: branches/uClibc-nptl/libc/misc/ctype/ctype.c
===================================================================
--- branches/uClibc-nptl/libc/misc/ctype/ctype.c	2009-01-21 02:52:59 UTC (rev 24934)
+++ branches/uClibc-nptl/libc/misc/ctype/ctype.c	2009-01-21 02:53:20 UTC (rev 24935)
@@ -433,7 +433,7 @@
 
 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_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_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)
 

Modified: branches/uClibc-nptl/libc/misc/locale/locale.c
===================================================================
--- branches/uClibc-nptl/libc/misc/locale/locale.c	2009-01-21 02:52:59 UTC (rev 24934)
+++ branches/uClibc-nptl/libc/misc/locale/locale.c	2009-01-21 02:53:20 UTC (rev 24935)
@@ -340,7 +340,7 @@
 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_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 @@
 		   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 @@
 	}
 #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 @@
 
 	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 {

Modified: branches/uClibc-nptl/libc/misc/wchar/wchar.c
===================================================================
--- branches/uClibc-nptl/libc/misc/wchar/wchar.c	2009-01-21 02:52:59 UTC (rev 24934)
+++ branches/uClibc-nptl/libc/misc/wchar/wchar.c	2009-01-21 02:53:20 UTC (rev 24935)
@@ -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 @@
 		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 @@
 			} 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 @@
 				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 @@
 					= __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) {

Modified: branches/uClibc-nptl/libc/misc/wctype/_wctype.c
===================================================================
--- branches/uClibc-nptl/libc/misc/wctype/_wctype.c	2009-01-21 02:52:59 UTC (rev 24934)
+++ branches/uClibc-nptl/libc/misc/wctype/_wctype.c	2009-01-21 02:53:20 UTC (rev 24935)
@@ -123,12 +123,12 @@
 #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 @@
 #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 @@
 #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 @@
 #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 @@
 					 <= 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 @@
 #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 */
 

Modified: branches/uClibc-nptl/libc/stdio/_fpmaxtostr.c
===================================================================
--- branches/uClibc-nptl/libc/stdio/_fpmaxtostr.c	2009-01-21 02:52:59 UTC (rev 24934)
+++ branches/uClibc-nptl/libc/stdio/_fpmaxtostr.c	2009-01-21 02:53:20 UTC (rev 24935)
@@ -501,8 +501,8 @@
 			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 @@
 						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 @@
 				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__ */

Modified: branches/uClibc-nptl/libc/stdio/_scanf.c
===================================================================
--- branches/uClibc-nptl/libc/stdio/_scanf.c	2009-01-21 02:52:59 UTC (rev 24934)
+++ branches/uClibc-nptl/libc/stdio/_scanf.c	2009-01-21 02:53:20 UTC (rev 24935)
@@ -719,26 +719,26 @@
 #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
@@ -1195,7 +1195,7 @@
 #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))) {

Modified: branches/uClibc-nptl/libc/stdio/_uintmaxtostr.c
===================================================================
--- branches/uClibc-nptl/libc/stdio/_uintmaxtostr.c	2009-01-21 02:52:59 UTC (rev 24934)
+++ branches/uClibc-nptl/libc/stdio/_uintmaxtostr.c	2009-01-21 02:53:20 UTC (rev 24935)
@@ -50,7 +50,7 @@
 	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 @@
     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 @@
 
 #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 @@
     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 @@
 
 #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
 		{

Modified: branches/uClibc-nptl/libc/stdio/_vfprintf.c
===================================================================
--- branches/uClibc-nptl/libc/stdio/_vfprintf.c	2009-01-21 02:52:59 UTC (rev 24934)
+++ branches/uClibc-nptl/libc/stdio/_vfprintf.c	2009-01-21 02:53:20 UTC (rev 24935)
@@ -525,7 +525,7 @@
 #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 @@
 
 #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];
 			}

Modified: branches/uClibc-nptl/libc/stdlib/stdlib.c
===================================================================
--- branches/uClibc-nptl/libc/stdlib/stdlib.c	2009-01-21 02:52:59 UTC (rev 24934)
+++ branches/uClibc-nptl/libc/stdlib/stdlib.c	2009-01-21 02:53:20 UTC (rev 24935)
@@ -114,7 +114,7 @@
 
 #ifdef __UCLIBC_HAS_LOCALE__
 
-#define ENCODING		((__UCLIBC_CURLOCALE_DATA).encoding)
+#define ENCODING		(__UCLIBC_CURLOCALE->encoding)
 #ifndef __CTYPE_HAS_UTF_8_LOCALES
 #ifdef L_mblen
 /* emit only once */
@@ -916,7 +916,7 @@
 size_t _stdlib_mb_cur_max(void)
 {
 #ifdef __CTYPE_HAS_UTF_8_LOCALES
-	return __UCLIBC_CURLOCALE_DATA.mb_cur_max;
+	return __UCLIBC_CURLOCALE->mb_cur_max;
 #else
 #ifdef __CTYPE_HAS_8_BIT_LOCALES
 #ifdef __UCLIBC_MJN3_ONLY__

Modified: branches/uClibc-nptl/libc/string/_collate.c
===================================================================
--- branches/uClibc-nptl/libc/string/_collate.c	2009-01-21 02:52:59 UTC (rev 24934)
+++ branches/uClibc-nptl/libc/string/_collate.c	2009-01-21 02:53:20 UTC (rev 24935)
@@ -81,7 +81,7 @@
 
 
 #if 0
-#define CUR_COLLATE (&__UCLIBC_CURLOCALE_DATA.collate)
+#define CUR_COLLATE (&__UCLIBC_CURLOCALE->collate)
 #else
 #define CUR_COLLATE (& __LOCALE_PTR->collate)
 #endif

Modified: branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_locale.h
===================================================================
--- branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_locale.h	2009-01-21 02:52:59 UTC (rev 24934)
+++ branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_locale.h	2009-01-21 02:53:20 UTC (rev 24935)
@@ -35,49 +35,38 @@
 
 #ifdef __UCLIBC_HAS_LOCALE__
 
-#undef __LOCALE_C_ONLY
+# undef __LOCALE_C_ONLY
 
-#else  /* __UCLIBC_HAS_LOCALE__ */
+#else
 
-#define __LOCALE_C_ONLY
+# define __LOCALE_C_ONLY
 
-#define __XL_NPP(N) N
-#define __LOCALE_PARAM
-#define __LOCALE_ARG
+# ifdef _LIBC
+#  define __XL_NPP(N) N
+#  define __LOCALE_PARAM
+#  define __LOCALE_ARG
+# endif
 
-#endif /* __UCLIBC_HAS_LOCALE__ */
+#endif
 
 /**********************************************************************/
 
-#define __NL_ITEM_CATEGORY_SHIFT		(8)
-#define __NL_ITEM_INDEX_MASK			(0xff)
+#define __NL_ITEM_CATEGORY_SHIFT        8
+#define __NL_ITEM_INDEX_MASK            0xff
 
 /* TODO: Make sure these agree with the locale mmap file gererator! */
 
-#define __LC_CTYPE			0
-#define __LC_NUMERIC		1
-#define __LC_MONETARY		2
-#define __LC_TIME			3
-#define __LC_COLLATE		4
-#define __LC_MESSAGES		5
-#define __LC_ALL			6
+#define __LC_CTYPE      0
+#define __LC_NUMERIC    1
+#define __LC_MONETARY   2
+#define __LC_TIME       3
+#define __LC_COLLATE    4
+#define __LC_MESSAGES   5
+#define __LC_ALL        6
 
 /**********************************************************************/
 #ifndef __LOCALE_C_ONLY
 
-#if defined _LIBC /* && (defined IS_IN_libc || defined NOT_IN_libc) */
-#include <stddef.h>
-#include <stdint.h>
-#include <bits/uClibc_touplow.h>
-
-#ifndef __UCLIBC_GEN_LOCALE
-#include <bits/uClibc_locale_data.h>
-#endif
-#endif
-
-/* extern void _locale_set(const unsigned char *p); */
-/* extern void _locale_init(void); */
-
 enum {
 	__ctype_encoding_7_bit,		/* C/POSIX */
 	__ctype_encoding_utf8,		/* UTF-8 */
@@ -98,7 +87,21 @@
   * In particular, C/POSIX locale is '#' + "\x80\x01"}*LC_ALL + nul.
   */
 
+struct __uclibc_locale_struct;
+typedef struct __uclibc_locale_struct *__locale_t;
+
 #ifdef _LIBC
+
+/* extern void _locale_set(const unsigned char *p); */
+/* extern void _locale_init(void); */
+
+#include <stddef.h>
+#include <stdint.h>
+#include <bits/uClibc_touplow.h>
+#ifndef __UCLIBC_GEN_LOCALE
+# include <bits/uClibc_locale_data.h>
+#endif
+
 #ifndef __UCLIBC_GEN_LOCALE /* && (defined IS_IN_libc || defined NOT_IN_libc) */
 typedef struct {
 	uint16_t num_weights;
@@ -140,10 +143,9 @@
 	uint16_t MAX_WEIGHTS;
 } __collate_t;
 
-
 /*  static unsigned char cur_locale[LOCALE_STRING_SIZE]; */
 
-typedef struct __uclibc_locale_struct {
+struct __uclibc_locale_struct {
 #ifdef __UCLIBC_HAS_XLOCALE__
 	const __ctype_mask_t *__ctype_b;
 	const __ctype_touplow_t *__ctype_tolower;
@@ -176,13 +178,13 @@
 	const unsigned char *tbl8ctype;
 	const unsigned char *idx8uplow;
 	const unsigned char *tbl8uplow;
-#ifdef __UCLIBC_HAS_WCHAR__
+# ifdef __UCLIBC_HAS_WCHAR__
 	const unsigned char *idx8c2wc;
 	const uint16_t *tbl8c2wc;	/* char > 0x7f to wide char */
 	const unsigned char *idx8wc2c;
 	const unsigned char *tbl8wc2c;
 	/* translit  */
-#endif /* __UCLIBC_HAS_WCHAR__ */
+# endif
 #endif /* __CTYPE_HAS_8_BIT_LOCALES */
 #ifdef __UCLIBC_HAS_WCHAR__
 
@@ -310,19 +312,16 @@
 
 	/* collate is at the end */
 	__collate_t collate;
+};
 
-} __uclibc_locale_t;
-
-extern __uclibc_locale_t __global_locale_data;
+extern struct __uclibc_locale_struct __global_locale_data;
+extern struct __uclibc_locale_struct *__global_locale;
 #endif /* !__UCLIBC_GEN_LOCALE */
-#endif /* _LIBC */
 
-extern struct __uclibc_locale_struct * __global_locale;
-
-typedef struct __uclibc_locale_struct *__locale_t;
-
-/* if we need to leave only _LIBC, then attribute_hidden is not usable */
-#if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc)
+#if defined IS_IN_libc || defined NOT_IN_libc
+/* If you plan to remove xxx_IN_libc guards,
+ * remove attribute_hidden, it won't work.
+ */
 extern int __locale_mbrtowc_l(wchar_t *__restrict dst,
 				const char *__restrict src,
 				__locale_t loc) attribute_hidden;
@@ -332,29 +331,22 @@
 /* so we only get the warning once... */
 #warning need thread version of CUR_LOCALE!
 #endif
+
 /**********************************************************************/
 #ifdef __UCLIBC_HAS_XLOCALE__
 
 extern __locale_t __curlocale_var;
-
 # ifdef __UCLIBC_HAS_THREADS__
-
 extern __locale_t __curlocale(void)  __THROW __attribute__ ((__const__));
 extern __locale_t __curlocale_set(__locale_t newloc);
-#  define __UCLIBC_CURLOCALE           (__curlocale())
-#  define __UCLIBC_CURLOCALE_DATA      (*__curlocale())
-
+#  define __UCLIBC_CURLOCALE  (__curlocale())
 # else
-
-#  define __UCLIBC_CURLOCALE           (__curlocale_var)
-#  define __UCLIBC_CURLOCALE_DATA      (*__curlocale_var)
-
+#  define __UCLIBC_CURLOCALE  (__curlocale_var)
 # endif
 
 #elif defined(__UCLIBC_HAS_LOCALE__)
 
-# define __UCLIBC_CURLOCALE           (__global_locale)
-# define __UCLIBC_CURLOCALE_DATA      (*__global_locale)
+# define __UCLIBC_CURLOCALE   (__global_locale)
 
 #endif
 /**********************************************************************/
@@ -375,7 +367,8 @@
 #endif
 /**********************************************************************/
 
+#endif /* _LIBC */
+
 #endif /* !defined(__LOCALE_C_ONLY) */
-/**********************************************************************/
 
 #endif /* _UCLIBC_LOCALE_H */



More information about the uClibc-cvs mailing list