svn commit: r235785 - in stable/9: contrib/gdtoa etc/mtree include include/xlocale lib/libc/gdtoa lib/libc/gen lib/libc/locale lib/libc/regex lib/libc/stdio lib/libc/stdlib lib/libc/stdtime lib/lib...

David Chisnall theraven at FreeBSD.org
Tue May 22 14:40:41 UTC 2012


Author: theraven
Date: Tue May 22 14:40:39 2012
New Revision: 235785
URL: http://svn.freebsd.org/changeset/base/235785

Log:
  MFC the xlocale implementation.
  
  Merged revisions: 227487,227753,227807,227818,227999,228002,228875,230156,231673,232498,232601,232620,232626,232926-232927,232929,232931,232935,233173,233600,234573,234578,235239
  
  This currently defines __NO_TLS on ARM (unlike head), because the required
  support function has not been MFC'd.

Added:
  stable/9/include/xlocale/
     - copied from r232498, head/include/xlocale/
  stable/9/include/xlocale.h
     - copied, changed from r227753, head/include/xlocale.h
  stable/9/lib/libc/locale/DESIGN.xlocale
     - copied unchanged from r227753, head/lib/libc/locale/DESIGN.xlocale
  stable/9/lib/libc/locale/ctype.c
     - copied unchanged from r227753, head/lib/libc/locale/ctype.c
  stable/9/lib/libc/locale/ctype_l.3
     - copied unchanged from r232935, head/lib/libc/locale/ctype_l.3
  stable/9/lib/libc/locale/duplocale.3
     - copied unchanged from r227753, head/lib/libc/locale/duplocale.3
  stable/9/lib/libc/locale/freelocale.3
     - copied unchanged from r227753, head/lib/libc/locale/freelocale.3
  stable/9/lib/libc/locale/newlocale.3
     - copied unchanged from r227753, head/lib/libc/locale/newlocale.3
  stable/9/lib/libc/locale/querylocale.3
     - copied unchanged from r227753, head/lib/libc/locale/querylocale.3
  stable/9/lib/libc/locale/uselocale.3
     - copied unchanged from r227753, head/lib/libc/locale/uselocale.3
  stable/9/lib/libc/locale/xlocale.3
     - copied unchanged from r227753, head/lib/libc/locale/xlocale.3
  stable/9/lib/libc/locale/xlocale.c
     - copied, changed from r227753, head/lib/libc/locale/xlocale.c
  stable/9/lib/libc/locale/xlocale_private.h
     - copied, changed from r227753, head/lib/libc/locale/xlocale_private.h
Modified:
  stable/9/contrib/gdtoa/gdtoaimp.h
  stable/9/contrib/gdtoa/strtod.c
  stable/9/contrib/gdtoa/strtodg.c
  stable/9/contrib/gdtoa/strtof.c
  stable/9/contrib/gdtoa/strtorQ.c
  stable/9/contrib/gdtoa/strtord.c
  stable/9/contrib/gdtoa/strtorx.c
  stable/9/etc/mtree/BSD.include.dist
  stable/9/include/Makefile
  stable/9/include/ctype.h
  stable/9/include/inttypes.h
  stable/9/include/langinfo.h
  stable/9/include/locale.h
  stable/9/include/monetary.h
  stable/9/include/runetype.h
  stable/9/include/stdio.h
  stable/9/include/stdlib.h
  stable/9/include/string.h
  stable/9/include/time.h
  stable/9/include/wchar.h
  stable/9/include/wctype.h
  stable/9/include/xlocale/_ctype.h
  stable/9/lib/libc/gdtoa/machdep_ldisQ.c
  stable/9/lib/libc/gdtoa/machdep_ldisd.c
  stable/9/lib/libc/gdtoa/machdep_ldisx.c
  stable/9/lib/libc/gen/_pthread_stubs.c
  stable/9/lib/libc/gen/fnmatch.c
  stable/9/lib/libc/gen/glob.c
  stable/9/lib/libc/locale/Makefile.inc
  stable/9/lib/libc/locale/Symbol.map
  stable/9/lib/libc/locale/ascii.c
  stable/9/lib/libc/locale/big5.c
  stable/9/lib/libc/locale/btowc.3
  stable/9/lib/libc/locale/btowc.c
  stable/9/lib/libc/locale/collate.c
  stable/9/lib/libc/locale/collate.h
  stable/9/lib/libc/locale/collcmp.c
  stable/9/lib/libc/locale/ctype.3
  stable/9/lib/libc/locale/digittoint.3
  stable/9/lib/libc/locale/euc.c
  stable/9/lib/libc/locale/gb18030.c
  stable/9/lib/libc/locale/gb2312.c
  stable/9/lib/libc/locale/gbk.c
  stable/9/lib/libc/locale/isalnum.3
  stable/9/lib/libc/locale/isalpha.3
  stable/9/lib/libc/locale/isblank.3
  stable/9/lib/libc/locale/iscntrl.3
  stable/9/lib/libc/locale/isdigit.3
  stable/9/lib/libc/locale/lmessages.c
  stable/9/lib/libc/locale/lmessages.h
  stable/9/lib/libc/locale/lmonetary.c
  stable/9/lib/libc/locale/lmonetary.h
  stable/9/lib/libc/locale/lnumeric.c
  stable/9/lib/libc/locale/lnumeric.h
  stable/9/lib/libc/locale/localeconv.3
  stable/9/lib/libc/locale/localeconv.c
  stable/9/lib/libc/locale/mblen.c
  stable/9/lib/libc/locale/mblocal.h
  stable/9/lib/libc/locale/mbrlen.c
  stable/9/lib/libc/locale/mbrtowc.c
  stable/9/lib/libc/locale/mbsinit.c
  stable/9/lib/libc/locale/mbsnrtowcs.c
  stable/9/lib/libc/locale/mbsrtowcs.c
  stable/9/lib/libc/locale/mbstowcs.c
  stable/9/lib/libc/locale/mbtowc.c
  stable/9/lib/libc/locale/mskanji.c
  stable/9/lib/libc/locale/nextwctype.c
  stable/9/lib/libc/locale/nl_langinfo.c
  stable/9/lib/libc/locale/nomacros.c
  stable/9/lib/libc/locale/none.c
  stable/9/lib/libc/locale/runetype.c
  stable/9/lib/libc/locale/setlocale.c
  stable/9/lib/libc/locale/setrunelocale.c
  stable/9/lib/libc/locale/table.c
  stable/9/lib/libc/locale/tolower.c
  stable/9/lib/libc/locale/toupper.c
  stable/9/lib/libc/locale/utf8.c
  stable/9/lib/libc/locale/wcrtomb.c
  stable/9/lib/libc/locale/wcsftime.c
  stable/9/lib/libc/locale/wcsnrtombs.c
  stable/9/lib/libc/locale/wcsrtombs.c
  stable/9/lib/libc/locale/wcstod.c
  stable/9/lib/libc/locale/wcstof.c
  stable/9/lib/libc/locale/wcstoimax.c
  stable/9/lib/libc/locale/wcstol.c
  stable/9/lib/libc/locale/wcstold.c
  stable/9/lib/libc/locale/wcstoll.c
  stable/9/lib/libc/locale/wcstombs.c
  stable/9/lib/libc/locale/wcstoul.c
  stable/9/lib/libc/locale/wcstoull.c
  stable/9/lib/libc/locale/wcstoumax.c
  stable/9/lib/libc/locale/wctob.c
  stable/9/lib/libc/locale/wctomb.c
  stable/9/lib/libc/locale/wctrans.c
  stable/9/lib/libc/locale/wctype.c
  stable/9/lib/libc/locale/wcwidth.c
  stable/9/lib/libc/regex/regcomp.c
  stable/9/lib/libc/stdio/Symbol.map
  stable/9/lib/libc/stdio/asprintf.c
  stable/9/lib/libc/stdio/fgetwc.c
  stable/9/lib/libc/stdio/fgetwln.c
  stable/9/lib/libc/stdio/fgetws.c
  stable/9/lib/libc/stdio/fprintf.c
  stable/9/lib/libc/stdio/fputwc.c
  stable/9/lib/libc/stdio/fputws.c
  stable/9/lib/libc/stdio/fscanf.c
  stable/9/lib/libc/stdio/fwprintf.c
  stable/9/lib/libc/stdio/fwscanf.c
  stable/9/lib/libc/stdio/getwc.c
  stable/9/lib/libc/stdio/getwchar.c
  stable/9/lib/libc/stdio/local.h
  stable/9/lib/libc/stdio/printf.c
  stable/9/lib/libc/stdio/printfcommon.h
  stable/9/lib/libc/stdio/putwc.c
  stable/9/lib/libc/stdio/putwchar.c
  stable/9/lib/libc/stdio/scanf.c
  stable/9/lib/libc/stdio/snprintf.c
  stable/9/lib/libc/stdio/sprintf.c
  stable/9/lib/libc/stdio/sscanf.c
  stable/9/lib/libc/stdio/swprintf.c
  stable/9/lib/libc/stdio/swscanf.c
  stable/9/lib/libc/stdio/ungetwc.c
  stable/9/lib/libc/stdio/vasprintf.c
  stable/9/lib/libc/stdio/vdprintf.c
  stable/9/lib/libc/stdio/vfprintf.c
  stable/9/lib/libc/stdio/vfscanf.c
  stable/9/lib/libc/stdio/vfwprintf.c
  stable/9/lib/libc/stdio/vfwscanf.c
  stable/9/lib/libc/stdio/vprintf.c
  stable/9/lib/libc/stdio/vscanf.c
  stable/9/lib/libc/stdio/vsnprintf.c
  stable/9/lib/libc/stdio/vsprintf.c
  stable/9/lib/libc/stdio/vsscanf.c
  stable/9/lib/libc/stdio/vswprintf.c
  stable/9/lib/libc/stdio/vswscanf.c
  stable/9/lib/libc/stdio/vwprintf.c
  stable/9/lib/libc/stdio/vwscanf.c
  stable/9/lib/libc/stdio/wprintf.c
  stable/9/lib/libc/stdio/wscanf.c
  stable/9/lib/libc/stdlib/Symbol.map
  stable/9/lib/libc/stdlib/atof.c
  stable/9/lib/libc/stdlib/atoi.c
  stable/9/lib/libc/stdlib/atol.c
  stable/9/lib/libc/stdlib/atoll.c
  stable/9/lib/libc/stdlib/strfmon.c
  stable/9/lib/libc/stdlib/strtoimax.c
  stable/9/lib/libc/stdlib/strtol.c
  stable/9/lib/libc/stdlib/strtoll.c
  stable/9/lib/libc/stdlib/strtoul.c
  stable/9/lib/libc/stdlib/strtoull.c
  stable/9/lib/libc/stdlib/strtoumax.c
  stable/9/lib/libc/stdtime/strftime.c
  stable/9/lib/libc/stdtime/strptime.c
  stable/9/lib/libc/stdtime/timelocal.c
  stable/9/lib/libc/stdtime/timelocal.h
  stable/9/lib/libc/string/Symbol.map
  stable/9/lib/libc/string/strcasecmp.c
  stable/9/lib/libc/string/strcasestr.c
  stable/9/lib/libc/string/strcoll.c
  stable/9/lib/libc/string/strxfrm.c
  stable/9/lib/libc/string/wcscoll.c
  stable/9/lib/libc/string/wcswidth.c
  stable/9/lib/libc/string/wcsxfrm.c
  stable/9/sys/sys/cdefs.h
Directory Properties:
  stable/9/contrib/gdtoa/   (props changed)
  stable/9/etc/   (props changed)
  stable/9/include/   (props changed)
  stable/9/lib/libc/   (props changed)
  stable/9/lib/libc/stdtime/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/contrib/gdtoa/gdtoaimp.h
==============================================================================
--- stable/9/contrib/gdtoa/gdtoaimp.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/contrib/gdtoa/gdtoaimp.h	Tue May 22 14:40:39 2012	(r235785)
@@ -201,6 +201,7 @@ THIS SOFTWARE.
 #include "namespace.h"
 #include <pthread.h>
 #include "un-namespace.h"
+#include "xlocale_private.h"
 
 #ifdef KR_headers
 #define Char char
@@ -525,11 +526,11 @@ extern void memcpy_D2A ANSI((void*, cons
 #define	strtoIQ		__strtoIQ
 #define	strtoIx		__strtoIx
 #define	strtoIxL	__strtoIxL
-#define	strtord		__strtord
+#define	strtord_l		__strtord_l
 #define	strtordd	__strtordd
 #define	strtorf		__strtorf
-#define	strtorQ		__strtorQ
-#define	strtorx		__strtorx
+#define	strtorQ_l		__strtorQ_l
+#define	strtorx_l		__strtorx_l
 #define	strtorxL	__strtorxL
 #define	strtodI		__strtodI
 #define	strtopd		__strtopd
@@ -634,7 +635,7 @@ extern void memcpy_D2A ANSI((void*, cons
  extern Bigint *s2b ANSI((CONST char*, int, int, ULong, int));
  extern Bigint *set_ones ANSI((Bigint*, int));
  extern char *strcp ANSI((char*, const char*));
- extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
+ extern int strtodg_l ANSI((CONST char*, char**, FPI*, Long*, ULong*, locale_t));
 
  extern int strtoId ANSI((CONST char *, char **, double *, double *));
  extern int strtoIdd ANSI((CONST char *, char **, double *, double *));
@@ -644,17 +645,18 @@ extern void memcpy_D2A ANSI((void*, cons
  extern int strtoIx ANSI((CONST char *, char **, void *, void *));
  extern int strtoIxL ANSI((CONST char *, char **, void *, void *));
  extern double strtod ANSI((const char *s00, char **se));
+ extern double strtod_l ANSI((const char *s00, char **se, locale_t));
  extern int strtopQ ANSI((CONST char *, char **, Void *));
  extern int strtopf ANSI((CONST char *, char **, float *));
  extern int strtopd ANSI((CONST char *, char **, double *));
  extern int strtopdd ANSI((CONST char *, char **, double *));
  extern int strtopx ANSI((CONST char *, char **, Void *));
  extern int strtopxL ANSI((CONST char *, char **, Void *));
- extern int strtord ANSI((CONST char *, char **, int, double *));
+ extern int strtord_l ANSI((CONST char *, char **, int, double *, locale_t));
  extern int strtordd ANSI((CONST char *, char **, int, double *));
  extern int strtorf ANSI((CONST char *, char **, int, float *));
- extern int strtorQ ANSI((CONST char *, char **, int, void *));
- extern int strtorx ANSI((CONST char *, char **, int, void *));
+ extern int strtorQ_l ANSI((CONST char *, char **, int, void *, locale_t));
+ extern int strtorx_l ANSI((CONST char *, char **, int, void *, locale_t));
  extern int strtorxL ANSI((CONST char *, char **, int, void *));
  extern Bigint *sum ANSI((Bigint*, Bigint*));
  extern int trailz ANSI((Bigint*));

Modified: stable/9/contrib/gdtoa/strtod.c
==============================================================================
--- stable/9/contrib/gdtoa/strtod.c	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/contrib/gdtoa/strtod.c	Tue May 22 14:40:39 2012	(r235785)
@@ -82,11 +82,11 @@ sulp
 #endif /*}*/
 
  double
-strtod
+strtod_l
 #ifdef KR_headers
-	(s00, se) CONST char *s00; char **se;
+	(s00, se, loc) CONST char *s00; char **se; locale_t loc
 #else
-	(CONST char *s00, char **se)
+	(CONST char *s00, char **se, locale_t loc)
 #endif
 {
 #ifdef Avoid_Underflow
@@ -108,14 +108,14 @@ strtod
 #endif
 #ifdef USE_LOCALE /*{{*/
 #ifdef NO_LOCALE_CACHE
-	char *decimalpoint = localeconv()->decimal_point;
+	char *decimalpoint = localeconv_l(loc)->decimal_point;
 	int dplen = strlen(decimalpoint);
 #else
 	char *decimalpoint;
 	static char *decimalpoint_cache;
 	static int dplen;
 	if (!(s0 = decimalpoint_cache)) {
-		s0 = localeconv()->decimal_point;
+		s0 = localeconv_l(loc)->decimal_point;
 		if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
 			strcpy(decimalpoint_cache, s0);
 			s0 = decimalpoint_cache;
@@ -1074,3 +1074,14 @@ strtod
 	return sign ? -dval(&rv) : dval(&rv);
 	}
 
+ double
+strtod
+#ifdef KR_headers
+	(s00, se, loc) CONST char *s00; char **se; locale_t
+#else
+	(CONST char *s00, char **se)
+#endif
+{
+	return strtod_l(s00, se, __get_locale());
+}
+

Modified: stable/9/contrib/gdtoa/strtodg.c
==============================================================================
--- stable/9/contrib/gdtoa/strtodg.c	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/contrib/gdtoa/strtodg.c	Tue May 22 14:40:39 2012	(r235785)
@@ -313,12 +313,12 @@ mantbits(U *d)
 	}
 
  int
-strtodg
+strtodg_l
 #ifdef KR_headers
-	(s00, se, fpi, exp, bits)
-	CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits;
+	(s00, se, fpi, exp, bits, loc)
+	CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits; locale_t loc;
 #else
-	(CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits)
+	(CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits, locale_t loc)
 #endif
 {
 	int abe, abits, asub;
@@ -334,14 +334,14 @@ strtodg
 	Bigint *ab, *bb, *bb1, *bd, *bd0, *bs, *delta, *rvb, *rvb0;
 #ifdef USE_LOCALE /*{{*/
 #ifdef NO_LOCALE_CACHE
-	char *decimalpoint = localeconv()->decimal_point;
+	char *decimalpoint = localeconv_l(loc)->decimal_point;
 	int dplen = strlen(decimalpoint);
 #else
 	char *decimalpoint;
 	static char *decimalpoint_cache;
 	static int dplen;
 	if (!(s0 = decimalpoint_cache)) {
-		s0 = localeconv()->decimal_point;
+		s0 = localeconv_l(loc)->decimal_point;
 		if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
 			strcpy(decimalpoint_cache, s0);
 			s0 = decimalpoint_cache;

Modified: stable/9/contrib/gdtoa/strtof.c
==============================================================================
--- stable/9/contrib/gdtoa/strtof.c	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/contrib/gdtoa/strtof.c	Tue May 22 14:40:39 2012	(r235785)
@@ -35,9 +35,9 @@ THIS SOFTWARE.
 
  float
 #ifdef KR_headers
-strtof(s, sp) CONST char *s; char **sp;
+strtof_l(s, sp, loc) CONST char *s; char **sp; locale_t loc;
 #else
-strtof(CONST char *s, char **sp)
+strtof_l(CONST char *s, char **sp, locale_t loc)
 #endif
 {
 	static FPI fpi0 = { 24, 1-127-24+1,  254-127-24+1, 1, SI };
@@ -51,7 +51,7 @@ strtof(CONST char *s, char **sp)
 #define fpi &fpi0
 #endif
 
-	k = strtodg(s, sp, fpi, &exp, bits);
+	k = strtodg_l(s, sp, fpi, &exp, bits, loc);
 	switch(k & STRTOG_Retmask) {
 	  case STRTOG_NoNumber:
 	  case STRTOG_Zero:
@@ -82,3 +82,13 @@ strtof(CONST char *s, char **sp)
 		u.L[0] |= 0x80000000L;
 	return u.f;
 	}
+ float
+#ifdef KR_headers
+strtof(s, sp) CONST char *s; char **sp;
+#else
+strtof(CONST char *s, char **sp)
+#endif
+{
+	return strtof_l(s, sp, __get_locale());
+}
+

Modified: stable/9/contrib/gdtoa/strtorQ.c
==============================================================================
--- stable/9/contrib/gdtoa/strtorQ.c	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/contrib/gdtoa/strtorQ.c	Tue May 22 14:40:39 2012	(r235785)
@@ -103,9 +103,10 @@ ULtoQ(ULong *L, ULong *bits, Long exp, i
 
  int
 #ifdef KR_headers
-strtorQ(s, sp, rounding, L) CONST char *s; char **sp; int rounding; void *L;
+strtorQ_l(s, sp, rounding, L, locale) CONST char *s; char **sp; int rounding;
+void *L; locale_t locale;
 #else
-strtorQ(CONST char *s, char **sp, int rounding, void *L)
+strtorQ_l(CONST char *s, char **sp, int rounding, void *L, locale_t locale)
 #endif
 {
 	static FPI fpi0 = { 113, 1-16383-113+1, 32766-16383-113+1, 1, SI };
@@ -120,7 +121,7 @@ strtorQ(CONST char *s, char **sp, int ro
 		fpi1.rounding = rounding;
 		fpi = &fpi1;
 		}
-	k = strtodg(s, sp, fpi, &exp, bits);
+	k = strtodg_l(s, sp, fpi, &exp, bits, locale);
 	ULtoQ((ULong*)L, bits, exp, k);
 	return k;
 	}

Modified: stable/9/contrib/gdtoa/strtord.c
==============================================================================
--- stable/9/contrib/gdtoa/strtord.c	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/contrib/gdtoa/strtord.c	Tue May 22 14:40:39 2012	(r235785)
@@ -70,9 +70,10 @@ ULtod(ULong *L, ULong *bits, Long exp, i
 
  int
 #ifdef KR_headers
-strtord(s, sp, rounding, d) CONST char *s; char **sp; int rounding; double *d;
+strtord_l(s, sp, rounding, d, locale) CONST char *s; char **sp; int rounding;
+double *d; locale_t locale;
 #else
-strtord(CONST char *s, char **sp, int rounding, double *d)
+strtord_l(CONST char *s, char **sp, int rounding, double *d, locale_t locale)
 #endif
 {
 	static FPI fpi0 = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI };
@@ -87,7 +88,8 @@ strtord(CONST char *s, char **sp, int ro
 		fpi1.rounding = rounding;
 		fpi = &fpi1;
 		}
-	k = strtodg(s, sp, fpi, &exp, bits);
+	k = strtodg_l(s, sp, fpi, &exp, bits, locale);
 	ULtod((ULong*)d, bits, exp, k);
 	return k;
 	}
+

Modified: stable/9/contrib/gdtoa/strtorx.c
==============================================================================
--- stable/9/contrib/gdtoa/strtorx.c	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/contrib/gdtoa/strtorx.c	Tue May 22 14:40:39 2012	(r235785)
@@ -106,9 +106,10 @@ ULtox(UShort *L, ULong *bits, Long exp, 
 
  int
 #ifdef KR_headers
-strtorx(s, sp, rounding, L) CONST char *s; char **sp; int rounding; void *L;
+strtorx_l(s, sp, rounding, L, locale) CONST char *s; char **sp; int rounding;
+void *L; locale_t locale;
 #else
-strtorx(CONST char *s, char **sp, int rounding, void *L)
+strtorx_l(CONST char *s, char **sp, int rounding, void *L, locale_t locale)
 #endif
 {
 	static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI };
@@ -123,7 +124,7 @@ strtorx(CONST char *s, char **sp, int ro
 		fpi1.rounding = rounding;
 		fpi = &fpi1;
 		}
-	k = strtodg(s, sp, fpi, &exp, bits);
+	k = strtodg_l(s, sp, fpi, &exp, bits, locale);
 	ULtox((UShort*)L, bits, exp, k);
 	return k;
 	}

Modified: stable/9/etc/mtree/BSD.include.dist
==============================================================================
--- stable/9/etc/mtree/BSD.include.dist	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/etc/mtree/BSD.include.dist	Tue May 22 14:40:39 2012	(r235785)
@@ -325,4 +325,6 @@
     ..
     vm
     ..
+    xlocale
+    ..
 ..

Modified: stable/9/include/Makefile
==============================================================================
--- stable/9/include/Makefile	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/Makefile	Tue May 22 14:40:39 2012	(r235785)
@@ -6,7 +6,7 @@
 .include <bsd.own.mk>
 
 CLEANFILES= osreldate.h version vers.c
-SUBDIR= arpa gssapi protocols rpcsvc rpc
+SUBDIR= arpa gssapi protocols rpcsvc rpc xlocale
 INCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
 	db.h \
 	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
@@ -24,7 +24,7 @@ INCS=	a.out.h ar.h assert.h bitstring.h 
 	strings.h sysexits.h tar.h termios.h tgmath.h \
 	time.h timeconv.h timers.h ttyent.h \
 	ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h vis.h \
-	wchar.h wctype.h wordexp.h
+	wchar.h wctype.h wordexp.h xlocale.h
 
 MHDRS=	float.h floatingpoint.h stdarg.h
 

Modified: stable/9/include/ctype.h
==============================================================================
--- stable/9/include/ctype.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/ctype.h	Tue May 22 14:40:39 2012	(r235785)
@@ -78,6 +78,10 @@ int	isphonogram(int);
 int	isrune(int);
 int	isspecial(int);
 #endif
+
+#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
+#include <xlocale/_ctype.h>
+#endif
 __END_DECLS
 
 #define	isalnum(c)	__sbistype((c), _CTYPE_A|_CTYPE_D)

Modified: stable/9/include/inttypes.h
==============================================================================
--- stable/9/include/inttypes.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/inttypes.h	Tue May 22 14:40:39 2012	(r235785)
@@ -45,6 +45,9 @@ typedef struct {
 } imaxdiv_t;
 
 __BEGIN_DECLS
+#ifdef _XLOCALE_H_
+#include <xlocale/_inttypes.h>
+#endif
 intmax_t	imaxabs(intmax_t) __pure2;
 imaxdiv_t	imaxdiv(intmax_t, intmax_t) __pure2;
 

Modified: stable/9/include/langinfo.h
==============================================================================
--- stable/9/include/langinfo.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/langinfo.h	Tue May 22 14:40:39 2012	(r235785)
@@ -130,6 +130,10 @@ typedef	__nl_item	nl_item;
 
 __BEGIN_DECLS
 char	*nl_langinfo(nl_item);
+
+#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
+#include <xlocale/_langinfo.h>
+#endif
 __END_DECLS
 
 #endif /* !_LANGINFO_H_ */

Modified: stable/9/include/locale.h
==============================================================================
--- stable/9/include/locale.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/locale.h	Tue May 22 14:40:39 2012	(r235785)
@@ -77,6 +77,11 @@ struct lconv {
 __BEGIN_DECLS
 struct lconv	*localeconv(void);
 char		*setlocale(int, const char *);
+
+#if __POSIX_VISIBLE >= 200809
+#include <xlocale/_locale.h>
+#endif
 __END_DECLS
 
+
 #endif /* _LOCALE_H_ */

Modified: stable/9/include/monetary.h
==============================================================================
--- stable/9/include/monetary.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/monetary.h	Tue May 22 14:40:39 2012	(r235785)
@@ -43,6 +43,9 @@ typedef	__ssize_t	ssize_t;
 #endif
 
 __BEGIN_DECLS
+#ifdef _XLOCALE_H_
+#include <xlocale/_monetary.h>
+#endif
 ssize_t	strfmon(char * __restrict, size_t, const char * __restrict, ...);
 __END_DECLS
 

Modified: stable/9/include/runetype.h
==============================================================================
--- stable/9/include/runetype.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/runetype.h	Tue May 22 14:40:39 2012	(r235785)
@@ -83,8 +83,24 @@ typedef struct {
 } _RuneLocale;
 
 #define	_RUNE_MAGIC_1	"RuneMagi"	/* Indicates version 0 of RuneLocale */
+__BEGIN_DECLS
+extern const _RuneLocale _DefaultRuneLocale;
+extern const _RuneLocale *_CurrentRuneLocale;
+#if defined(__NO_TLS) || defined(__RUNETYPE_INTERNAL)
+extern const _RuneLocale *__getCurrentRuneLocale(void);
+#else
+extern _Thread_local const _RuneLocale *_ThreadRuneLocale;
+static __inline const _RuneLocale *__getCurrentRuneLocale(void)
+{
 
-extern _RuneLocale _DefaultRuneLocale;
-extern _RuneLocale *_CurrentRuneLocale;
+	if (_ThreadRuneLocale) 
+		return _ThreadRuneLocale;
+	if (_CurrentRuneLocale) 
+		return _CurrentRuneLocale;
+	return &_DefaultRuneLocale;
+}
+#endif /* __NO_TLS || __RUNETYPE_INTERNAL */
+#define _CurrentRuneLocale (__getCurrentRuneLocale())
+__END_DECLS
 
 #endif	/* !_RUNETYPE_H_ */

Modified: stable/9/include/stdio.h
==============================================================================
--- stable/9/include/stdio.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/stdio.h	Tue May 22 14:40:39 2012	(r235785)
@@ -107,7 +107,7 @@ struct __sbuf {
  * inline functions.  To preserve ABI compat, these members must not
  * be disturbed.  These members are marked below with (*).
  */
-typedef	struct __sFILE {
+struct __sFILE {
 	unsigned char *_p;	/* (*) current position in (some) buffer */
 	int	_r;		/* (*) read space left for getc() */
 	int	_w;		/* (*) write space left for putc() */
@@ -144,8 +144,11 @@ typedef	struct __sFILE {
 	int	_fl_count;	/* recursive lock count */
 	int	_orientation;	/* orientation for fwide() */
 	__mbstate_t _mbstate;	/* multibyte conversion state */
-} FILE;
-
+};
+#ifndef _STDFILE_DECLARED
+#define _STDFILE_DECLARED
+typedef struct __sFILE FILE;
+#endif
 #ifndef _STDSTREAM_DECLARED
 __BEGIN_DECLS
 extern FILE *__stdinp;
@@ -222,6 +225,9 @@ __END_DECLS
 #define	stderr	__stderrp
 
 __BEGIN_DECLS
+#ifdef _XLOCALE_H_
+#include <xlocale/_stdio.h>
+#endif
 /*
  * Functions defined in ANSI C standard.
  */
@@ -468,12 +474,15 @@ static __inline int __sputc(int _c, FILE
 		(*(p)->_p = (c), (int)*(p)->_p++))
 #endif
 
+extern int __isthreaded;
+
+#ifndef __cplusplus
+
 #define	__sfeof(p)	(((p)->_flags & __SEOF) != 0)
 #define	__sferror(p)	(((p)->_flags & __SERR) != 0)
 #define	__sclearerr(p)	((void)((p)->_flags &= ~(__SERR|__SEOF)))
 #define	__sfileno(p)	((p)->_file)
 
-extern int __isthreaded;
 
 #define	feof(p)		(!__isthreaded ? __sfeof(p) : (feof)(p))
 #define	ferror(p)	(!__isthreaded ? __sferror(p) : (ferror)(p))
@@ -506,6 +515,7 @@ extern int __isthreaded;
 #define	getchar_unlocked()	getc_unlocked(stdin)
 #define	putchar_unlocked(x)	putc_unlocked(x, stdout)
 #endif
+#endif /* __cplusplus */
 
 __END_DECLS
 #endif /* !_STDIO_H_ */

Modified: stable/9/include/stdlib.h
==============================================================================
--- stable/9/include/stdlib.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/stdlib.h	Tue May 22 14:40:39 2012	(r235785)
@@ -71,10 +71,14 @@ typedef struct {
 
 #define	RAND_MAX	0x7fffffff
 
+__BEGIN_DECLS
+#ifdef _XLOCALE_H_
+#include <xlocale/_stdlib.h>
+#endif
 extern int __mb_cur_max;
-#define	MB_CUR_MAX	__mb_cur_max
+extern int ___mb_cur_max(void);
+#define	MB_CUR_MAX	(___mb_cur_max())
 
-__BEGIN_DECLS
 void	 abort(void) __dead2;
 int	 abs(int) __pure2;
 int	 atexit(void (*)(void));

Modified: stable/9/include/string.h
==============================================================================
--- stable/9/include/string.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/string.h	Tue May 22 14:40:39 2012	(r235785)
@@ -132,6 +132,10 @@ void	 swab(const void * __restrict, void
 #endif /* _SWAB_DECLARED */
 
 #endif /* __BSD_VISIBLE */
+
+#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
+#include <xlocale/_string.h>
+#endif
 __END_DECLS
 
 #endif /* _STRING_H_ */

Modified: stable/9/include/time.h
==============================================================================
--- stable/9/include/time.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/time.h	Tue May 22 14:40:39 2012	(r235785)
@@ -183,6 +183,10 @@ void tzsetwall(void);
 time_t timelocal(struct tm * const);
 time_t timegm(struct tm * const);
 #endif /* __BSD_VISIBLE */
+
+#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
+#include <xlocale/_time.h>
+#endif
 __END_DECLS
 
 #endif /* !_TIME_H_ */

Modified: stable/9/include/wchar.h
==============================================================================
--- stable/9/include/wchar.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/wchar.h	Tue May 22 14:40:39 2012	(r235785)
@@ -97,20 +97,23 @@ typedef	__wint_t	wint_t;
 #define	WEOF 	((wint_t)-1)
 #endif
 
-struct __sFILE;
+#ifndef _STDFILE_DECLARED
+#define _STDFILE_DECLARED
+typedef struct __sFILE FILE;
+#endif
 struct tm;
 
 __BEGIN_DECLS
 wint_t	btowc(int);
-wint_t	fgetwc(struct __sFILE *);
+wint_t	fgetwc(FILE *);
 wchar_t	*
-	fgetws(wchar_t * __restrict, int, struct __sFILE * __restrict);
-wint_t	fputwc(wchar_t, struct __sFILE *);
-int	fputws(const wchar_t * __restrict, struct __sFILE * __restrict);
-int	fwide(struct __sFILE *, int);
-int	fwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);
-int	fwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);
-wint_t	getwc(struct __sFILE *);
+	fgetws(wchar_t * __restrict, int, FILE * __restrict);
+wint_t	fputwc(wchar_t, FILE *);
+int	fputws(const wchar_t * __restrict, FILE * __restrict);
+int	fwide(FILE *, int);
+int	fwprintf(FILE * __restrict, const wchar_t * __restrict, ...);
+int	fwscanf(FILE * __restrict, const wchar_t * __restrict, ...);
+wint_t	getwc(FILE *);
 wint_t	getwchar(void);
 size_t	mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
 size_t	mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
@@ -118,13 +121,13 @@ size_t	mbrtowc(wchar_t * __restrict, con
 int	mbsinit(const mbstate_t *);
 size_t	mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
 	    mbstate_t * __restrict);
-wint_t	putwc(wchar_t, struct __sFILE *);
+wint_t	putwc(wchar_t, FILE *);
 wint_t	putwchar(wchar_t);
 int	swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
 	    ...);
 int	swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
-wint_t	ungetwc(wint_t, struct __sFILE *);
-int	vfwprintf(struct __sFILE * __restrict, const wchar_t * __restrict,
+wint_t	ungetwc(wint_t, FILE *);
+int	vfwprintf(FILE * __restrict, const wchar_t * __restrict,
 	    __va_list);
 int	vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
 	    __va_list);
@@ -167,9 +170,9 @@ int	wprintf(const wchar_t * __restrict, 
 int	wscanf(const wchar_t * __restrict, ...);
 
 #ifndef _STDSTREAM_DECLARED
-extern struct __sFILE *__stdinp;
-extern struct __sFILE *__stdoutp;
-extern struct __sFILE *__stderrp;
+extern FILE *__stdinp;
+extern FILE *__stdoutp;
+extern FILE *__stderrp;
 #define	_STDSTREAM_DECLARED
 #endif
 
@@ -179,7 +182,7 @@ extern struct __sFILE *__stderrp;
 #define	putwchar(wc)	fputwc(wc, __stdoutp)
 
 #if __ISO_C_VISIBLE >= 1999
-int	vfwscanf(struct __sFILE * __restrict, const wchar_t * __restrict,
+int	vfwscanf(FILE * __restrict, const wchar_t * __restrict,
 	    __va_list);
 int	vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
 	    __va_list);
@@ -217,10 +220,14 @@ size_t	wcsnrtombs(char * __restrict, con
 #endif
 
 #if __BSD_VISIBLE
-wchar_t	*fgetwln(struct __sFILE * __restrict, size_t * __restrict);
+wchar_t	*fgetwln(FILE * __restrict, size_t * __restrict);
 size_t	wcslcat(wchar_t *, const wchar_t *, size_t);
 size_t	wcslcpy(wchar_t *, const wchar_t *, size_t);
 #endif
+
+#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
+#include <xlocale/_wchar.h>
+#endif
 __END_DECLS
 
 #endif /* !_WCHAR_H_ */

Modified: stable/9/include/wctype.h
==============================================================================
--- stable/9/include/wctype.h	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/include/wctype.h	Tue May 22 14:40:39 2012	(r235785)
@@ -87,6 +87,11 @@ wint_t	iswrune(wint_t);
 wint_t	iswspecial(wint_t);
 wint_t	nextwctype(wint_t, wctype_t);
 #endif
+
+#if __POSIX_VISIBLE >= 200809
+#define _XLOCALE_WCTYPES 1
+#include <xlocale/_ctype.h>
+#endif /* __POSIX_VISIBLE >= 200809 */
 __END_DECLS
 
 #define	iswalnum(wc)		__istype((wc), _CTYPE_A|_CTYPE_D)

Copied and modified: stable/9/include/xlocale.h (from r227753, head/include/xlocale.h)
==============================================================================
--- head/include/xlocale.h	Sun Nov 20 14:45:42 2011	(r227753, copy source)
+++ stable/9/include/xlocale.h	Tue May 22 14:40:39 2012	(r235785)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2011 The FreeBSD Foundation
+ * Copyright (c) 2011, 2012 The FreeBSD Foundation
  * All rights reserved.
  *
  * This software was developed by David Chisnall under sponsorship from
@@ -8,16 +8,16 @@
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 1.  Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -33,225 +33,52 @@
 #define _XLOCALE_H_
 
 #include <locale.h>
-
 __BEGIN_DECLS
+#include <xlocale/_locale.h>
 
-/*
- * Extended locale versions of the locale-aware functions from string.h.
- *
- * Include <string.h> before <xlocale.h> to expose these.
- */
 #ifdef _STRING_H_
-int	 strcoll_l(const char *, const char *, locale_t);
-size_t	 strxfrm_l(char *, const char *, size_t, locale_t);
-int	 strcasecmp_l(const char *, const char *, locale_t);
-char	*strcasestr_l(const char *, const char *, locale_t);
-int	 strncasecmp_l(const char *, const char *, size_t, locale_t);
+#include <xlocale/_string.h>
 #endif
-/*
- * Extended locale versions of the locale-aware functions from inttypes.h.
- *
- * Include <inttypes.h> before <xlocale.h> to expose these.
- */
+
 #ifdef _INTTYPES_H_
-intmax_t 
-strtoimax_l(const char * __restrict, char ** __restrict, int, locale_t);
-uintmax_t
-strtoumax_l(const char * __restrict, char ** __restrict, int, locale_t);
-intmax_t 
-wcstoimax_l(const wchar_t * __restrict, wchar_t ** __restrict, int , locale_t);
-uintmax_t
-wcstoumax_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t);
+#include <xlocale/_inttypes.h>
 #endif
-/*
- * Extended locale versions of the locale-aware functions from monetary.h.
- *
- * Include <monetary.h> before <xlocale.h> to expose these.
- */
+
 #ifdef _MONETARY_H_
-ssize_t strfmon_l(char *, size_t, locale_t, const char *, ...)
-#	if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7
-	__attribute__((__format__ (__strfmon__, 4, 5)))
-#	endif
-	;
+#include <xlocale/_monetary.h>
 #endif
 
-/*
- * Extended locale versions of the locale-aware functions from stdlib.h.
- *
- * Include <stdlib.h> before <xlocale.h> to expose these.
- */
 #ifdef _STDLIB_H_
-double	 atof_l(const char *, locale_t);
-int	 atoi_l(const char *, locale_t);
-long	 atol_l(const char *, locale_t);
-long long	 atoll_l(const char *, locale_t);
-int	 mblen_l(const char *, size_t, locale_t);
-size_t
-mbstowcs_l(wchar_t * __restrict, const char * __restrict, size_t, locale_t);
-int
-mbtowc_l(wchar_t * __restrict, const char * __restrict, size_t, locale_t);
-double	 strtod_l(const char *, char **, locale_t);
-float	 strtof_l(const char *, char **, locale_t);
-long	 strtol_l(const char *, char **, int, locale_t);
-long	 double strtold_l(const char *, char **, locale_t);
-long long	 strtoll_l(const char *, char **, int, locale_t);
-unsigned long	 strtoul_l(const char *, char **, int, locale_t);
-unsigned long long	 strtoull_l(const char *, char **, int, locale_t);
-size_t
-wcstombs_l(char * __restrict, const wchar_t * __restrict, size_t, locale_t);
-int	 wctomb_l(char *, wchar_t, locale_t);
-
-int	 ___mb_cur_max_l(locale_t);
-#define MB_CUR_MAX_L(x) (___mb_cur_max_l(x))
-
+#include <xlocale/_stdlib.h>
 #endif
-/*
- * Extended locale versions of the locale-aware functions from time.h.
- *
- * Include <time.h> before <xlocale.h> to expose these.
- */
+
 #ifdef _TIME_H_
-size_t
-strftime_l(char * __restrict, size_t, const char * __restrict, const
-           struct tm * __restrict, locale_t)
-#	if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7
-	__attribute__((__format__ (__strftime__, 3, 0)))
-#	endif
-	;
-char *
-strptime_l(const char * __restrict, const char * __restrict,
-           struct tm * __restrict, locale_t);
+#include <xlocale/_time.h>
 #endif
+
 #ifdef _LANGINFO_H_
-char	*nl_langinfo_l(nl_item, locale_t);
+#include <xlocale/_langinfo.h>
 #endif
+
 #ifdef _CTYPE_H_
-#include <_xlocale_ctype.h>
+#include <xlocale/_ctype.h>
 #endif
+
 #ifdef _WCTYPE_H_
-#define XLOCALE_WCTYPES 1
-#include <_xlocale_ctype.h>
+#define _XLOCALE_WCTYPES 1
+#include <xlocale/_ctype.h>
 #endif
 
 #ifdef _STDIO_H_
-int	 fprintf_l(FILE * __restrict, locale_t, const char * __restrict, ...)
-		__printflike(3, 4);
-int	 fscanf_l(FILE * __restrict, locale_t, const char * __restrict, ...)
-		__scanflike(3, 4);
-int	 printf_l(locale_t, const char * __restrict, ...) __printflike(2, 3);
-int	 scanf_l(locale_t, const char * __restrict, ...) __scanflike(2, 3);
-int	 sprintf_l(char * __restrict, locale_t, const char * __restrict, ...)
-		__printflike(3, 4);
-int	 sscanf_l(const char * __restrict, locale_t, const char * __restrict, ...)
-		__scanflike(3, 4);
-int	 vfprintf_l(FILE * __restrict, locale_t, const char * __restrict, __va_list)
-		__printflike(3, 0);
-int	 vprintf_l(locale_t, const char * __restrict, __va_list) __printflike(2, 0);
-int	 vsprintf_l(char * __restrict, locale_t, const char * __restrict, __va_list)
-		__printflike(3, 0);
-
-int	 snprintf_l(char * __restrict, size_t, locale_t, const char * __restrict,
-		...) __printflike(4, 5);
-int	 vfscanf_l(FILE * __restrict, locale_t, const char * __restrict, __va_list)
-		__scanflike(3, 0);
-int	 vscanf_l(locale_t, const char * __restrict, __va_list) __scanflike(2, 0);
-int	 vsnprintf_l(char * __restrict, size_t, locale_t, const char * __restrict,
-		va_list) __printflike(4, 0);
-int	 vsscanf_l(const char * __restrict, locale_t, const char * __restrict,
-		va_list) __scanflike(3, 0);
-int	 dprintf_l(int, locale_t, const char * __restrict, ...) __printflike(3, 4);
-int	 vdprintf_l(int, locale_t, const char * __restrict, __va_list)
-		__printflike(3, 0);
-int	 asprintf_l(char **, locale_t, const char *, ...) __printflike(3, 4);
-int	 vasprintf_l(char **, locale_t, const char *, __va_list) __printflike(3, 0);
+#include <xlocale/_stdio.h>
 #endif
-#ifdef _WCHAR_H_
-wint_t	 btowc_l(int, locale_t);
-wint_t	 fgetwc_l(FILE *, locale_t);
-wchar_t *
-fgetws_l(wchar_t * __restrict, int, FILE * __restrict, locale_t);
-wint_t	 fputwc_l(wchar_t, FILE *, locale_t);
-int
-fputws_l(const wchar_t * __restrict, FILE * __restrict, locale_t);
-int
-fwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
-		...);
-int
-fwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...);
-wint_t	 getwc_l(FILE *, locale_t);
-wint_t	 getwchar_l(locale_t);
-size_t
-mbrlen_l(const char * __restrict, size_t, mbstate_t * __restrict, locale_t);
-size_t
-mbrtowc_l(wchar_t * __restrict, const char * __restrict, size_t,
-		mbstate_t * __restrict, locale_t);
-int	 mbsinit_l(const mbstate_t *, locale_t);
-size_t
-mbsrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t,
-		mbstate_t * __restrict, locale_t);
-wint_t	 putwc_l(wchar_t, FILE *, locale_t);
-wint_t	 putwchar_l(wchar_t, locale_t);
-int
-swprintf_l(wchar_t * __restrict, size_t n, locale_t,
-		const wchar_t * __restrict, ...);
-int
-swscanf_l(const wchar_t * __restrict, locale_t, const wchar_t * __restrict,
-		...);
-wint_t	 ungetwc_l(wint_t, FILE *, locale_t);
-int
-vfwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
-		__va_list);
-int
-vswprintf_l(wchar_t * __restrict, size_t n, locale_t,
-		const wchar_t * __restrict, __va_list);
-int	 vwprintf_l(locale_t, const wchar_t * __restrict, __va_list);
-size_t
-wcrtomb_l(char * __restrict, wchar_t, mbstate_t * __restrict, locale_t);
-int	 wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
-size_t
-wcsftime_l(wchar_t * __restrict, size_t, const wchar_t * __restrict,
-		const struct tm * __restrict, locale_t);
-size_t 
-wcsrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t,
-		mbstate_t * __restrict, locale_t);
-double	 wcstod_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
-long
-wcstol_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t);
-unsigned long
-wcstoul_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t);
-int	 wcswidth_l(const wchar_t *, size_t, locale_t);
-size_t
-wcsxfrm_l(wchar_t * __restrict, const wchar_t * __restrict, size_t, locale_t);
-int	 wctob_l(wint_t, locale_t);
-int	 wcwidth_l(wchar_t, locale_t);
-int	 wprintf_l(locale_t, const wchar_t * __restrict, ...);
-int	 wscanf_l(locale_t, const wchar_t * __restrict, ...);
-
-int
-vfwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
-		__va_list);
-int	 vswscanf_l(const wchar_t * __restrict, locale_t,
-const wchar_t	*__restrict, __va_list);
-int	 vwscanf_l(locale_t, const wchar_t * __restrict, __va_list);
-float 	wcstof_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
-long double
-wcstold_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
-long long
-wcstoll_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t);
-unsigned long long
-wcstoull_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t);
-size_t
-mbsnrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t, size_t,
-		mbstate_t * __restrict, locale_t);
-int	 wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
-int	 wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
-size_t
-wcsnrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t, size_t,
-		mbstate_t * __restrict, locale_t);
 
+#ifdef _WCHAR_H_
+#include <xlocale/_wchar.h>
 #endif
 
+
+
 struct lconv	*localeconv_l(locale_t);
 __END_DECLS
 

Modified: stable/9/include/xlocale/_ctype.h
==============================================================================
--- head/include/xlocale/_ctype.h	Sun Mar  4 15:31:13 2012	(r232498)
+++ stable/9/include/xlocale/_ctype.h	Tue May 22 14:40:39 2012	(r235785)
@@ -55,11 +55,11 @@ _RuneLocale	*__runes_for_locale(locale_t
 #ifndef _XLOCALE_INLINE
 #if __GNUC__ && !__GNUC_STDC_INLINE__
 /* GNU89 inline has nonstandard semantics. */
-#define _XLOCALE_INLINE extern inline
+#define _XLOCALE_INLINE extern __inline
 #else
 /* Hack to work around people who define inline away */
 #ifdef inline
-#define _XLOCALE_INLINE __inline static
+#define _XLOCALE_INLINE static __inline
 #else
 /* Define with C++ / C99 compatible semantics */
 #define _XLOCALE_INLINE inline
@@ -68,19 +68,24 @@ _RuneLocale	*__runes_for_locale(locale_t
 #endif /* _XLOCALE_INLINE */
 
 #ifdef _XLOCALE_WCTYPES
-static __inline int
-__maskrune_l(__ct_rune_t _c, unsigned long _f, locale_t locale)
+_XLOCALE_INLINE int
+__maskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
+_XLOCALE_INLINE int
+__istype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
+
+_XLOCALE_INLINE int
+__maskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
 {
-	int mb_sb_limit;
-	_RuneLocale *runes = __runes_for_locale(locale, &mb_sb_limit);
-	return (_c < 0 || _c >= _CACHED_RUNES) ? ___runetype_l(_c, locale) :
-	       runes->__runetype[_c] & _f;
+	int __limit;
+	_RuneLocale *runes = __runes_for_locale(__loc, &__limit);
+	return ((__c < 0 || __c >= _CACHED_RUNES) ? ___runetype_l(__c, __loc) :
+	        runes->__runetype[__c]) & __f;
 }
 
-static __inline int
-__istype_l(__ct_rune_t _c, unsigned long _f, locale_t locale)
+_XLOCALE_INLINE int
+__istype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
 {
-	return (!!__maskrune_l(_c, _f, locale));
+	return (!!__maskrune_l(__c, __f, __loc));
 }
 
 #define XLOCALE_ISCTYPE(fname, cat) \
@@ -88,25 +93,30 @@ __istype_l(__ct_rune_t _c, unsigned long
 		_XLOCALE_INLINE int isw##fname##_l(int __c, locale_t __l)\
 		{ return __istype_l(__c, cat, __l); }
 #else
-static __inline int
-__sbmaskrune_l(__ct_rune_t _c, unsigned long _f, locale_t locale)
+_XLOCALE_INLINE int
+__sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
+_XLOCALE_INLINE int
+__sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
+
+_XLOCALE_INLINE int
+__sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
 {
-	int mb_sb_limit;
-	_RuneLocale *runes = __runes_for_locale(locale, &mb_sb_limit);
-	return (_c < 0 || _c >= mb_sb_limit) ? 0 :
-	       runes->__runetype[_c] & _f;
+	int __limit;
+	_RuneLocale *runes = __runes_for_locale(__loc, &__limit);
+	return (__c < 0 || __c >= __limit) ? 0 :
+	       runes->__runetype[__c] & __f;
 }
 
-static __inline int
-__sbistype_l(__ct_rune_t _c, unsigned long _f, locale_t locale)
+_XLOCALE_INLINE int
+__sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
 {
-	return (!!__sbmaskrune_l(_c, _f, locale));
+	return (!!__sbmaskrune_l(__c, __f, __loc));
 }
 
-#define XLOCALE_ISCTYPE(fname, cat) \
-		_XLOCALE_INLINE int is##fname##_l(int c, locale_t l); \
-		_XLOCALE_INLINE int is##fname##_l(int c, locale_t l)\
-		{ return __sbistype_l(c, cat, l); }
+#define XLOCALE_ISCTYPE(__fname, __cat) \
+		_XLOCALE_INLINE int is##__fname##_l(int, locale_t); \
+		_XLOCALE_INLINE int is##__fname##_l(int __c, locale_t __l)\
+		{ return __sbistype_l(__c, __cat, __l); }
 #endif
 
 XLOCALE_ISCTYPE(alnum, _CTYPE_A|_CTYPE_D)
@@ -136,15 +146,15 @@ _XLOCALE_INLINE int towupper_l(int, loca
 
 _XLOCALE_INLINE int towlower_l(int __c, locale_t __l)
 {
-	int mb_sb_limit;
-	_RuneLocale *__runes = __runes_for_locale(__l, &mb_sb_limit);
+	int __limit;
+	_RuneLocale *__runes = __runes_for_locale(__l, &__limit);
 	return (__c < 0 || __c >= _CACHED_RUNES) ? ___tolower_l(__c, __l) :
 	       __runes->__maplower[__c];
 }
 _XLOCALE_INLINE int towupper_l(int __c, locale_t __l)
 {
-	int mb_sb_limit;
-	_RuneLocale *__runes = __runes_for_locale(__l, &mb_sb_limit);
+	int __limit;
+	_RuneLocale *__runes = __runes_for_locale(__l, &__limit);
 	return (__c < 0 || __c >= _CACHED_RUNES) ? ___toupper_l(__c, __l) :
 	       __runes->__mapupper[__c];
 }

Modified: stable/9/lib/libc/gdtoa/machdep_ldisQ.c
==============================================================================
--- stable/9/lib/libc/gdtoa/machdep_ldisQ.c	Tue May 22 13:14:21 2012	(r235784)
+++ stable/9/lib/libc/gdtoa/machdep_ldisQ.c	Tue May 22 14:40:39 2012	(r235785)
@@ -2,6 +2,11 @@
  * Copyright (c) 2003 David Schultz <das at FreeBSD.ORG>
  * All rights reserved.
  *
+ * Copyright (c) 2011 The FreeBSD Foundation
+ * All rights reserved.
+ * Portions of this software were developed by David Chisnall
+ * under sponsorship from the FreeBSD Foundation.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -38,10 +43,10 @@ __FBSDID("$FreeBSD$");
 #include "gdtoaimp.h"
 
 long double
-strtold(const char * __restrict s, char ** __restrict sp)
+strtold_l(const char * __restrict s, char ** __restrict sp, locale_t locale)
 {
 	long double result;
 
-	strtorQ(s, sp, FLT_ROUNDS, &result);
+	strtorQ_l(s, sp, FLT_ROUNDS, &result, locale);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-stable-9 mailing list