Module Name: src Committed By: joerg Date: Fri May 17 12:55:57 UTC 2013
Modified Files: src/common/lib/libc/stdlib: _strtol.h _strtoul.h src/include: locale.h src/lib/libc/gdtoa: strtod.c strtof.c strtof_vaxf.c strtold_subr.c src/lib/libc/gen: isctype.c src/lib/libc/locale: Makefile.inc _wcstod.h _wcstol.h _wcstoul.h freelocale.c global_locale.c iswctype_mb.c localeconv.c multibyte_amd1.c multibyte_c90.c nb_lc_template.h newlocale.c setlocale.c setlocale_local.h wcscoll.c wcsxfrm.c src/lib/libc/stdio: vasprintf.c vdprintf.c vfscanf.c vfwprintf.c vfwscanf.c vsnprintf.c vsprintf.c vsscanf.c vswprintf.c vswscanf.c src/lib/libc/string: strcoll.c strxfrm.c wcscasecmp.c wcsncasecmp.c src/lib/libc/time: strftime.c strptime.c Removed Files: src/lib/libc/locale: c_locale.c current_locale.c Log Message: Provide explicit LC_C_LOCALE accessor and drop the various NULL checks. Provide LC_GLOBAL_LOCALE in a way that works with all locale functions. Merge constant data used by the initial global locale and the C locale. Drop function call layer for _current_locale() and directly return the locale reference, not a pointer to it. Use protected access for global variables, so that libc references can avoid the GOT overhead. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/stdlib/_strtol.h \ src/common/lib/libc/stdlib/_strtoul.h cvs rdiff -u -r1.21 -r1.22 src/include/locale.h cvs rdiff -u -r1.13 -r1.14 src/lib/libc/gdtoa/strtod.c cvs rdiff -u -r1.6 -r1.7 src/lib/libc/gdtoa/strtof.c cvs rdiff -u -r1.7 -r1.8 src/lib/libc/gdtoa/strtof_vaxf.c cvs rdiff -u -r1.2 -r1.3 src/lib/libc/gdtoa/strtold_subr.c cvs rdiff -u -r1.23 -r1.24 src/lib/libc/gen/isctype.c cvs rdiff -u -r1.62 -r1.63 src/lib/libc/locale/Makefile.inc \ src/lib/libc/locale/setlocale.c cvs rdiff -u -r1.3 -r1.4 src/lib/libc/locale/_wcstod.h \ src/lib/libc/locale/wcscoll.c cvs rdiff -u -r1.5 -r1.6 src/lib/libc/locale/_wcstol.h \ src/lib/libc/locale/_wcstoul.h src/lib/libc/locale/nb_lc_template.h cvs rdiff -u -r1.2 -r0 src/lib/libc/locale/c_locale.c cvs rdiff -u -r1.4 -r0 src/lib/libc/locale/current_locale.c cvs rdiff -u -r1.1 -r1.2 src/lib/libc/locale/freelocale.c \ src/lib/libc/locale/newlocale.c cvs rdiff -u -r1.16 -r1.17 src/lib/libc/locale/global_locale.c cvs rdiff -u -r1.12 -r1.13 src/lib/libc/locale/iswctype_mb.c cvs rdiff -u -r1.20 -r1.21 src/lib/libc/locale/localeconv.c cvs rdiff -u -r1.11 -r1.12 src/lib/libc/locale/multibyte_amd1.c \ src/lib/libc/locale/setlocale_local.h cvs rdiff -u -r1.9 -r1.10 src/lib/libc/locale/multibyte_c90.c cvs rdiff -u -r1.4 -r1.5 src/lib/libc/locale/wcsxfrm.c cvs rdiff -u -r1.15 -r1.16 src/lib/libc/stdio/vasprintf.c cvs rdiff -u -r1.3 -r1.4 src/lib/libc/stdio/vdprintf.c cvs rdiff -u -r1.44 -r1.45 src/lib/libc/stdio/vfscanf.c cvs rdiff -u -r1.31 -r1.32 src/lib/libc/stdio/vfwprintf.c cvs rdiff -u -r1.9 -r1.10 src/lib/libc/stdio/vfwscanf.c cvs rdiff -u -r1.26 -r1.27 src/lib/libc/stdio/vsnprintf.c cvs rdiff -u -r1.18 -r1.19 src/lib/libc/stdio/vsprintf.c cvs rdiff -u -r1.20 -r1.21 src/lib/libc/stdio/vsscanf.c cvs rdiff -u -r1.4 -r1.5 src/lib/libc/stdio/vswprintf.c cvs rdiff -u -r1.11 -r1.12 src/lib/libc/stdio/vswscanf.c cvs rdiff -u -r1.11 -r1.12 src/lib/libc/string/strcoll.c cvs rdiff -u -r1.13 -r1.14 src/lib/libc/string/strxfrm.c cvs rdiff -u -r1.3 -r1.4 src/lib/libc/string/wcscasecmp.c \ src/lib/libc/string/wcsncasecmp.c cvs rdiff -u -r1.25 -r1.26 src/lib/libc/time/strftime.c cvs rdiff -u -r1.37 -r1.38 src/lib/libc/time/strptime.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/common/lib/libc/stdlib/_strtol.h diff -u src/common/lib/libc/stdlib/_strtol.h:1.6 src/common/lib/libc/stdlib/_strtol.h:1.7 --- src/common/lib/libc/stdlib/_strtol.h:1.6 Fri Apr 26 21:20:48 2013 +++ src/common/lib/libc/stdlib/_strtol.h Fri May 17 12:55:56 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: _strtol.h,v 1.6 2013/04/26 21:20:48 joerg Exp $ */ +/* $NetBSD: _strtol.h,v 1.7 2013/05/17 12:55:56 joerg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -192,14 +192,12 @@ INT_FUNCNAME(_int_, _FUNCNAME, _l)(const __INT _FUNCNAME(const char *nptr, char **endptr, int base) { - return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, *_current_locale()); + return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, _current_locale()); } __INT INT_FUNCNAME(, _FUNCNAME, _l)(const char *nptr, char **endptr, int base, locale_t loc) { - if (loc == NULL) - loc = _C_locale; return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, loc); } #endif Index: src/common/lib/libc/stdlib/_strtoul.h diff -u src/common/lib/libc/stdlib/_strtoul.h:1.6 src/common/lib/libc/stdlib/_strtoul.h:1.7 --- src/common/lib/libc/stdlib/_strtoul.h:1.6 Fri Apr 26 21:20:48 2013 +++ src/common/lib/libc/stdlib/_strtoul.h Fri May 17 12:55:56 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: _strtoul.h,v 1.6 2013/04/26 21:20:48 joerg Exp $ */ +/* $NetBSD: _strtoul.h,v 1.7 2013/05/17 12:55:56 joerg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -152,14 +152,12 @@ INT_FUNCNAME(_int_, _FUNCNAME, _l)(const __UINT _FUNCNAME(const char *nptr, char **endptr, int base) { - return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, *_current_locale()); + return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, _current_locale()); } __UINT INT_FUNCNAME(, _FUNCNAME, _l)(const char *nptr, char **endptr, int base, locale_t loc) { - if (loc == NULL) - loc = _C_locale; return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, loc); } #endif Index: src/include/locale.h diff -u src/include/locale.h:1.21 src/include/locale.h:1.22 --- src/include/locale.h:1.21 Tue Apr 30 00:45:04 2013 +++ src/include/locale.h Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: locale.h,v 1.21 2013/04/30 00:45:04 joerg Exp $ */ +/* $NetBSD: locale.h,v 1.22 2013/05/17 12:55:57 joerg Exp $ */ /* * Copyright (c) 1991, 1993 @@ -85,10 +85,6 @@ typedef struct _locale *locale_t; # endif #endif -#ifdef __SETLOCALE_SOURCE__ -#define _LC_GLOBAL_LOCALE ((locale_t)-1) -#endif - __BEGIN_DECLS struct lconv *localeconv(void); char *setlocale(int, const char *) __RENAME(__setlocale50); @@ -109,6 +105,16 @@ locale_t duplocale(locale_t); void freelocale(locale_t); struct lconv *localeconv_l(locale_t); locale_t newlocale(int, const char *, locale_t); + +#ifndef _LIBC +extern struct _locale _lc_global_locale; +extern const struct _locale _lc_C_locale; +#else +extern __dso_protected struct _locale _lc_global_locale; +extern __dso_protected const struct _locale _lc_C_locale; +#endif +#define LC_GLOBAL_LOCALE (&_lc_global_locale) +#define LC_C_LOCALE ((locale_t)__UNCONST(&_lc_C_locale)) #endif __END_DECLS Index: src/lib/libc/gdtoa/strtod.c diff -u src/lib/libc/gdtoa/strtod.c:1.13 src/lib/libc/gdtoa/strtod.c:1.14 --- src/lib/libc/gdtoa/strtod.c:1.13 Fri Apr 19 10:41:53 2013 +++ src/lib/libc/gdtoa/strtod.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: strtod.c,v 1.13 2013/04/19 10:41:53 joerg Exp $ */ +/* $NetBSD: strtod.c,v 1.14 2013/05/17 12:55:57 joerg Exp $ */ /**************************************************************** @@ -1103,7 +1103,7 @@ _int_strtod_l(CONST char *s00, char **se double strtod(CONST char *s, char **sp) { - return _int_strtod_l(s, sp, *_current_locale()); + return _int_strtod_l(s, sp, _current_locale()); } #ifdef __weak_alias @@ -1113,7 +1113,5 @@ __weak_alias(strtod_l, _strtod_l) double strtod_l(CONST char *s, char **sp, locale_t loc) { - if (loc == NULL) - loc = _C_locale; return _int_strtod_l(s, sp, loc); } Index: src/lib/libc/gdtoa/strtof.c diff -u src/lib/libc/gdtoa/strtof.c:1.6 src/lib/libc/gdtoa/strtof.c:1.7 --- src/lib/libc/gdtoa/strtof.c:1.6 Thu Apr 18 21:54:11 2013 +++ src/lib/libc/gdtoa/strtof.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: strtof.c,v 1.6 2013/04/18 21:54:11 joerg Exp $ */ +/* $NetBSD: strtof.c,v 1.7 2013/05/17 12:55:57 joerg Exp $ */ /**************************************************************** @@ -96,13 +96,11 @@ _int_strtof_l(CONST char *s, char **sp, float strtof(CONST char *s, char **sp) { - return _int_strtof_l(s, sp, *_current_locale()); + return _int_strtof_l(s, sp, _current_locale()); } float strtof_l(CONST char *s, char **sp, locale_t loc) { - if (loc == NULL) - loc = _C_locale; return _int_strtof_l(s, sp, loc); } Index: src/lib/libc/gdtoa/strtof_vaxf.c diff -u src/lib/libc/gdtoa/strtof_vaxf.c:1.7 src/lib/libc/gdtoa/strtof_vaxf.c:1.8 --- src/lib/libc/gdtoa/strtof_vaxf.c:1.7 Thu Apr 18 21:54:11 2013 +++ src/lib/libc/gdtoa/strtof_vaxf.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: strtof_vaxf.c,v 1.7 2013/04/18 21:54:11 joerg Exp $ */ +/* $NetBSD: strtof_vaxf.c,v 1.8 2013/05/17 12:55:57 joerg Exp $ */ /**************************************************************** @@ -83,13 +83,11 @@ _int_strtof_l(CONST char *s, char **sp, float strtof(CONST char *s, char **sp) { - return _int_strtof_l(s, sp, *_current_locale()); + return _int_strtof_l(s, sp, _current_locale()); } float strtof_l(CONST char *s, char **sp, locale_t loc) { - if (loc == NULL) - loc = _C_locale; return _int_strtof_l(s, sp, loc); } Index: src/lib/libc/gdtoa/strtold_subr.c diff -u src/lib/libc/gdtoa/strtold_subr.c:1.2 src/lib/libc/gdtoa/strtold_subr.c:1.3 --- src/lib/libc/gdtoa/strtold_subr.c:1.2 Thu Apr 18 21:54:11 2013 +++ src/lib/libc/gdtoa/strtold_subr.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: strtold_subr.c,v 1.2 2013/04/18 21:54:11 joerg Exp $ */ +/* $NetBSD: strtold_subr.c,v 1.3 2013/05/17 12:55:57 joerg Exp $ */ /* * Written by Klaus Klein <kle...@netbsd.org>, November 16, 2005. @@ -15,7 +15,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: strtold_subr.c,v 1.2 2013/04/18 21:54:11 joerg Exp $"); +__RCSID("$NetBSD: strtold_subr.c,v 1.3 2013/05/17 12:55:57 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -53,13 +53,11 @@ _int_strtold_l(const char *nptr, char ** long double strtold(CONST char *s, char **sp) { - return _int_strtold_l(s, sp, *_current_locale()); + return _int_strtold_l(s, sp, _current_locale()); } long double strtold_l(CONST char *s, char **sp, locale_t loc) { - if (loc == NULL) - loc = _C_locale; return _int_strtold_l(s, sp, loc); } Index: src/lib/libc/gen/isctype.c diff -u src/lib/libc/gen/isctype.c:1.23 src/lib/libc/gen/isctype.c:1.24 --- src/lib/libc/gen/isctype.c:1.23 Tue Apr 16 11:29:13 2013 +++ src/lib/libc/gen/isctype.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: isctype.c,v 1.23 2013/04/16 11:29:13 joerg Exp $ */ +/* $NetBSD: isctype.c,v 1.24 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c)2008 Citrus Project, @@ -28,7 +28,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: isctype.c,v 1.23 2013/04/16 11:29:13 joerg Exp $"); +__RCSID("$NetBSD: isctype.c,v 1.24 2013/05/17 12:55:57 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -57,8 +57,6 @@ is##name(int c) \ int \ is##name ## _l(int c, locale_t loc) \ { \ - if (loc == NULL) \ - loc = _C_locale; \ return (int)(((loc->cache->ctype_tab + 1)[c]) & (bit)); \ } @@ -84,8 +82,6 @@ toupper(int c) int toupper_l(int c, locale_t loc) { - if (loc == NULL) - loc = _C_locale; return (int)(((loc->cache->toupper_tab + 1)[c])); } @@ -98,8 +94,6 @@ tolower(int c) int tolower_l(int c, locale_t loc) { - if (loc == NULL) - loc = _C_locale; return (int)(((loc->cache->tolower_tab + 1)[c])); } Index: src/lib/libc/locale/Makefile.inc diff -u src/lib/libc/locale/Makefile.inc:1.62 src/lib/libc/locale/Makefile.inc:1.63 --- src/lib/libc/locale/Makefile.inc:1.62 Tue Apr 30 00:45:05 2013 +++ src/lib/libc/locale/Makefile.inc Fri May 17 12:55:57 2013 @@ -1,12 +1,12 @@ # from: @(#)Makefile.inc 5.1 (Berkeley) 2/18/91 -# $NetBSD: Makefile.inc,v 1.62 2013/04/30 00:45:05 joerg Exp $ +# $NetBSD: Makefile.inc,v 1.63 2013/05/17 12:55:57 joerg Exp $ # locale sources .PATH: ${ARCHDIR}/locale ${.CURDIR}/locale SRCS+= _def_messages.c _def_monetary.c _def_numeric.c _def_time.c \ setlocale.c __mb_cur_max.c \ - current_locale.c c_locale.c duplocale.c global_locale.c fix_grouping.c \ + duplocale.c global_locale.c fix_grouping.c \ freelocale.c localeconv.c newlocale.c nl_langinfo.c \ generic_lc_all.c dummy_lc_collate.c \ wcstol.c wcstoll.c wcstoimax.c wcstoul.c wcstoull.c wcstoumax.c \ Index: src/lib/libc/locale/setlocale.c diff -u src/lib/libc/locale/setlocale.c:1.62 src/lib/libc/locale/setlocale.c:1.63 --- src/lib/libc/locale/setlocale.c:1.62 Tue Apr 30 00:45:05 2013 +++ src/lib/libc/locale/setlocale.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: setlocale.c,v 1.62 2013/04/30 00:45:05 joerg Exp $ */ +/* $NetBSD: setlocale.c,v 1.63 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c)2008 Citrus Project, @@ -28,7 +28,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: setlocale.c,v 1.62 2013/04/30 00:45:05 joerg Exp $"); +__RCSID("$NetBSD: setlocale.c,v 1.63 2013/05/17 12:55:57 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -101,7 +101,7 @@ __setlocale(int category, const char *na sl = _find_category(category); if (sl == NULL) return NULL; - impl = *_current_locale(); + impl = _current_locale(); return __UNCONST((*sl)(name, impl)); } Index: src/lib/libc/locale/_wcstod.h diff -u src/lib/libc/locale/_wcstod.h:1.3 src/lib/libc/locale/_wcstod.h:1.4 --- src/lib/libc/locale/_wcstod.h:1.3 Thu Apr 18 22:23:17 2013 +++ src/lib/libc/locale/_wcstod.h Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: _wcstod.h,v 1.3 2013/04/18 22:23:17 joerg Exp $ */ +/* $NetBSD: _wcstod.h,v 1.4 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c) 2002 Tim J. Robbins @@ -134,15 +134,13 @@ _RETURN_TYPE INT_NAME(, _FUNCNAME, )(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr) { - return INT_NAME(_int_, _FUNCNAME, _l)(nptr, endptr, *_current_locale()); + return INT_NAME(_int_, _FUNCNAME, _l)(nptr, endptr, _current_locale()); } _RETURN_TYPE INT_NAME(, _FUNCNAME, _l)(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, locale_t loc) { - if (loc == NULL) - loc = _C_locale; return INT_NAME(_int_, _FUNCNAME, _l)(nptr, endptr, loc); } #endif /*__WCSTOD_H_*/ Index: src/lib/libc/locale/wcscoll.c diff -u src/lib/libc/locale/wcscoll.c:1.3 src/lib/libc/locale/wcscoll.c:1.4 --- src/lib/libc/locale/wcscoll.c:1.3 Thu Apr 18 23:24:27 2013 +++ src/lib/libc/locale/wcscoll.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: wcscoll.c,v 1.3 2013/04/18 23:24:27 joerg Exp $ */ +/* $NetBSD: wcscoll.c,v 1.4 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c)2003 Citrus Project, @@ -28,7 +28,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: wcscoll.c,v 1.3 2013/04/18 23:24:27 joerg Exp $"); +__RCSID("$NetBSD: wcscoll.c,v 1.4 2013/05/17 12:55:57 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -44,8 +44,6 @@ __RCSID("$NetBSD: wcscoll.c,v 1.3 2013/0 int wcscoll_l(const wchar_t *s1, const wchar_t *s2, locale_t loc) { - if (loc == NULL) - loc = _C_locale; /* XXX: LC_COLLATE should be implemented. */ /* LINTED */ (void)loc; return (wcscmp(s1, s2)); @@ -54,5 +52,5 @@ wcscoll_l(const wchar_t *s1, const wchar int wcscoll(const wchar_t *s1, const wchar_t *s2) { - return wcscoll_l(s1, s2, *_current_locale()); + return wcscoll_l(s1, s2, _current_locale()); } Index: src/lib/libc/locale/_wcstol.h diff -u src/lib/libc/locale/_wcstol.h:1.5 src/lib/libc/locale/_wcstol.h:1.6 --- src/lib/libc/locale/_wcstol.h:1.5 Tue Apr 16 16:52:13 2013 +++ src/lib/libc/locale/_wcstol.h Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: _wcstol.h,v 1.5 2013/04/16 16:52:13 joerg Exp $ */ +/* $NetBSD: _wcstol.h,v 1.6 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -150,14 +150,12 @@ __INT _FUNCNAME(const wchar_t *nptr, wchar_t **endptr, int base) { return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, - *_current_locale()); + _current_locale()); } __INT INT_FUNCNAME(, _FUNCNAME, _l)(const wchar_t *nptr, wchar_t **endptr, int base, locale_t loc) { - if (loc == NULL) - loc = _C_locale; return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, loc); } Index: src/lib/libc/locale/_wcstoul.h diff -u src/lib/libc/locale/_wcstoul.h:1.5 src/lib/libc/locale/_wcstoul.h:1.6 --- src/lib/libc/locale/_wcstoul.h:1.5 Tue Apr 16 16:52:13 2013 +++ src/lib/libc/locale/_wcstoul.h Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: _wcstoul.h,v 1.5 2013/04/16 16:52:13 joerg Exp $ */ +/* $NetBSD: _wcstoul.h,v 1.6 2013/05/17 12:55:57 joerg Exp $ */ /* * Copyright (c) 1990, 1993 @@ -126,14 +126,12 @@ __UINT _FUNCNAME(const wchar_t *nptr, wchar_t **endptr, int base) { return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, - *_current_locale()); + _current_locale()); } __UINT INT_FUNCNAME(, _FUNCNAME, _l)(const wchar_t *nptr, wchar_t **endptr, int base, locale_t loc) { - if (loc == NULL) - loc = _C_locale; return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, loc); } Index: src/lib/libc/locale/nb_lc_template.h diff -u src/lib/libc/locale/nb_lc_template.h:1.5 src/lib/libc/locale/nb_lc_template.h:1.6 --- src/lib/libc/locale/nb_lc_template.h:1.5 Sun Apr 14 23:30:16 2013 +++ src/lib/libc/locale/nb_lc_template.h Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: nb_lc_template.h,v 1.5 2013/04/14 23:30:16 joerg Exp $ */ +/* $NetBSD: nb_lc_template.h,v 1.6 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c)1999, 2008 Citrus Project, @@ -236,7 +236,7 @@ _PREFIX(setlocale)(const char * __restri locale->part_impl[(size_t)_CATEGORY_ID] = part->impl; _PREFIX(build_cache)(locale->cache, part->impl); - if (locale == &_global_locale) + if (locale == &_lc_global_locale) _PREFIX(fixup)(part->impl); } } Index: src/lib/libc/locale/freelocale.c diff -u src/lib/libc/locale/freelocale.c:1.1 src/lib/libc/locale/freelocale.c:1.2 --- src/lib/libc/locale/freelocale.c:1.1 Tue Apr 30 00:45:05 2013 +++ src/lib/libc/locale/freelocale.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: freelocale.c,v 1.1 2013/04/30 00:45:05 joerg Exp $ */ +/* $NetBSD: freelocale.c,v 1.2 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c)2008, 2011 Citrus Project, @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: freelocale.c,v 1.1 2013/04/30 00:45:05 joerg Exp $"); +__RCSID("$NetBSD: freelocale.c,v 1.2 2013/05/17 12:55:57 joerg Exp $"); #include "namespace.h" @@ -44,8 +44,8 @@ void freelocale(locale_t locale) { - _DIAGASSERT(locale != _LC_GLOBAL_LOCALE); + _DIAGASSERT(locale != LC_GLOBAL_LOCALE); + _DIAGASSERT(locale != LC_C_LOCALE); _DIAGASSERT(locale != NULL); - _DIAGASSERT(locale != &_global_locale); free(locale); } Index: src/lib/libc/locale/newlocale.c diff -u src/lib/libc/locale/newlocale.c:1.1 src/lib/libc/locale/newlocale.c:1.2 --- src/lib/libc/locale/newlocale.c:1.1 Tue Apr 30 00:45:05 2013 +++ src/lib/libc/locale/newlocale.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: newlocale.c,v 1.1 2013/04/30 00:45:05 joerg Exp $ */ +/* $NetBSD: newlocale.c,v 1.2 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c)2008, 2011 Citrus Project, @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: newlocale.c,v 1.1 2013/04/30 00:45:05 joerg Exp $"); +__RCSID("$NetBSD: newlocale.c,v 1.2 2013/05/17 12:55:57 joerg Exp $"); #include "namespace.h" #include <assert.h> @@ -55,7 +55,7 @@ newlocale(int mask, const char *name, lo if (dst == NULL) return (locale_t)NULL; if (src == NULL) - src = *_current_locale(); + src = _current_locale(); memcpy(dst, src, sizeof(*src)); strlcpy(&head[0], name, sizeof(head)); tokens[0] = (const char *)&head[0]; Index: src/lib/libc/locale/global_locale.c diff -u src/lib/libc/locale/global_locale.c:1.16 src/lib/libc/locale/global_locale.c:1.17 --- src/lib/libc/locale/global_locale.c:1.16 Sun Apr 21 17:45:46 2013 +++ src/lib/libc/locale/global_locale.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: global_locale.c,v 1.16 2013/04/21 17:45:46 joerg Exp $ */ +/* $NetBSD: global_locale.c,v 1.17 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c)2008 Citrus Project, @@ -28,7 +28,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: global_locale.c,v 1.16 2013/04/21 17:45:46 joerg Exp $"); +__RCSID("$NetBSD: global_locale.c,v 1.17 2013/05/17 12:55:57 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -47,7 +47,7 @@ __RCSID("$NetBSD: global_locale.c,v 1.16 #define NBCHAR_MAX (char)CHAR_MAX #endif -static struct lconv _global_ldata = { +static const struct lconv _C_ldata = { .decimal_point = __UNCONST("."), .thousands_sep = __UNCONST(""), .grouping = __UNCONST(""), @@ -74,7 +74,7 @@ static struct lconv _global_ldata = { .int_n_sign_posn = NBCHAR_MAX, }; -static const char *_global_items[(size_t)ALT_DIGITS + 1] = { +static const char * const _C_items [(size_t)ALT_DIGITS + 1] = { [(size_t)D_T_FMT ] = "%a %b %e %H:%M:%S %Y", [(size_t)D_FMT ] = "%m/%d/%y", [(size_t)T_FMT ] = "%H:%M:%S", @@ -139,15 +139,15 @@ static struct _locale_cache_t _global_ca .tolower_tab = (const short *)&_C_tolower_tab_[0], .toupper_tab = (const short *)&_C_toupper_tab_[0], .mb_cur_max = (size_t)1, - .ldata = &_global_ldata, - .items = &_global_items[0], + .ldata = __UNCONST(&_C_ldata), + .items = __UNCONST(&_C_items[0]), #ifdef __BUILD_LEGACY .compat_bsdctype = (const unsigned char *)&_C_compat_bsdctype[0], #endif }; -struct _locale _global_locale = { +__dso_protected struct _locale _lc_global_locale = { .cache = &_global_cache, .query = { _C_LOCALE }, .part_name = { @@ -174,3 +174,44 @@ struct _locale _global_locale = { __UNCONST(&_DefaultTimeLocale), }, }; + +static const struct _locale_cache_t _C_cache = { + .ctype_tab = (const unsigned short *)&_C_ctype_tab_[0], + .tolower_tab = (const short *)&_C_tolower_tab_[0], + .toupper_tab = (const short *)&_C_toupper_tab_[0], + .mb_cur_max = (size_t)1, + .ldata = __UNCONST(&_C_ldata), + .items = __UNCONST(&_C_items[0]), + +#ifdef __BUILD_LEGACY + .compat_bsdctype = (const unsigned char *)&_C_compat_bsdctype[0], +#endif +}; + +__dso_protected const struct _locale _lc_C_locale = { + .cache = __UNCONST(&_C_cache), + .query = { _C_LOCALE }, + .part_name = { + [(size_t)LC_ALL ] = _C_LOCALE, + [(size_t)LC_COLLATE ] = _C_LOCALE, + [(size_t)LC_CTYPE ] = _C_LOCALE, + [(size_t)LC_MONETARY] = _C_LOCALE, + [(size_t)LC_NUMERIC ] = _C_LOCALE, + [(size_t)LC_TIME ] = _C_LOCALE, + [(size_t)LC_MESSAGES] = _C_LOCALE, + }, + .part_impl = { + [(size_t)LC_ALL ] = (_locale_part_t)NULL, + [(size_t)LC_COLLATE ] = (_locale_part_t)NULL, + [(size_t)LC_CTYPE ] = (_locale_part_t) + __UNCONST(&_DefaultRuneLocale), + [(size_t)LC_MONETARY] = (_locale_part_t) + __UNCONST(&_DefaultMonetaryLocale), + [(size_t)LC_NUMERIC ] = (_locale_part_t) + __UNCONST(&_DefaultNumericLocale), + [(size_t)LC_MESSAGES] = (_locale_part_t) + __UNCONST(&_DefaultMessagesLocale), + [(size_t)LC_TIME] = (_locale_part_t) + __UNCONST(&_DefaultTimeLocale), + }, +}; Index: src/lib/libc/locale/iswctype_mb.c diff -u src/lib/libc/locale/iswctype_mb.c:1.12 src/lib/libc/locale/iswctype_mb.c:1.13 --- src/lib/libc/locale/iswctype_mb.c:1.12 Tue Apr 16 11:39:13 2013 +++ src/lib/libc/locale/iswctype_mb.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: iswctype_mb.c,v 1.12 2013/04/16 11:39:13 joerg Exp $ */ +/* $NetBSD: iswctype_mb.c,v 1.13 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c)2008 Citrus Project, @@ -28,7 +28,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: iswctype_mb.c,v 1.12 2013/04/16 11:39:13 joerg Exp $"); +__RCSID("$NetBSD: iswctype_mb.c,v 1.13 2013/05/17 12:55:57 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -57,9 +57,6 @@ isw##name##_l(wint_t wc, locale_t loc) _RuneLocale const *rl; \ _WCTypeEntry const *te; \ \ - if (loc == NULL) \ - loc = _C_locale; \ - \ rl = _RUNE_LOCALE(loc); \ te = &rl->rl_wctype[index]; \ return _iswctype_priv(rl, wc, te); \ @@ -67,7 +64,7 @@ isw##name##_l(wint_t wc, locale_t loc) int \ isw##name(wint_t wc) \ { \ - return isw##name##_l(wc, *_current_locale()); \ + return isw##name##_l(wc, _current_locale()); \ } _ISWCTYPE_FUNC(alnum, _WCTYPE_INDEX_ALNUM) @@ -90,9 +87,6 @@ tow##name##_l(wint_t wc, locale_t loc) _RuneLocale const *rl; \ _WCTransEntry const *te; \ \ - if (loc == NULL) \ - loc = _C_locale; \ - \ rl = _RUNE_LOCALE(loc); \ te = &rl->rl_wctrans[index]; \ return _towctrans_priv(wc, te); \ @@ -100,7 +94,7 @@ tow##name##_l(wint_t wc, locale_t loc) wint_t \ tow##name(wint_t wc) \ { \ - return tow##name##_l(wc, *_current_locale()); \ + return tow##name##_l(wc, _current_locale()); \ } _TOWCTRANS_FUNC(upper, _WCTRANS_INDEX_UPPER) _TOWCTRANS_FUNC(lower, _WCTRANS_INDEX_LOWER) @@ -111,9 +105,6 @@ wctype_l(const char *charclass, locale_t _RuneLocale const *rl; size_t i; - if (loc == NULL) - loc = _C_locale; - rl = _RUNE_LOCALE(loc); for (i = 0; i < _WCTYPE_NINDEXES; ++i) { if (!strcmp(rl->rl_wctype[i].te_name, charclass)) @@ -125,7 +116,7 @@ wctype_l(const char *charclass, locale_t wctype_t wctype(const char *charclass) { - return wctype_l(charclass, *_current_locale()); + return wctype_l(charclass, _current_locale()); } wctrans_t @@ -134,9 +125,6 @@ wctrans_l(const char *charmap, locale_t _RuneLocale const *rl; size_t i; - if (loc == NULL) - loc = _C_locale; - rl = _RUNE_LOCALE(loc); for (i = 0; i < _WCTRANS_NINDEXES; ++i) { _DIAGASSERT(rl->rl_wctrans[i].te_name != NULL); @@ -149,7 +137,7 @@ wctrans_l(const char *charmap, locale_t wctrans_t wctrans(const char *charmap) { - return wctrans_l(charmap, *_current_locale()); + return wctrans_l(charmap, _current_locale()); } int @@ -163,9 +151,6 @@ iswctype_l(wint_t wc, wctype_t charclass return 0; } - if (loc == NULL) - loc = _C_locale; - rl = _RUNE_LOCALE(loc); te = (_WCTypeEntry const *)(void *)charclass; return _iswctype_priv(rl, wc, te); @@ -174,7 +159,7 @@ iswctype_l(wint_t wc, wctype_t charclass int iswctype(wint_t wc, wctype_t charclass) { - return iswctype_l(wc, charclass, *_current_locale()); + return iswctype_l(wc, charclass, _current_locale()); } wint_t @@ -209,9 +194,6 @@ wcwidth_l(wchar_t wc, locale_t loc) if (wc == L'\0') return 0; - if (loc == NULL) - loc = _C_locale; - rl = _RUNE_LOCALE(loc); x = _runetype_priv(rl, wc); if (x & _RUNETYPE_R) @@ -222,7 +204,7 @@ wcwidth_l(wchar_t wc, locale_t loc) int wcwidth(wchar_t wc) { - return wcwidth_l(wc, *_current_locale()); + return wcwidth_l(wc, _current_locale()); } int @@ -234,9 +216,6 @@ wcswidth_l(const wchar_t * __restrict ws _DIAGASSERT(ws != NULL); - if (loc == NULL) - loc = _C_locale; - rl = _RUNE_LOCALE(loc); width = 0; while (wn > 0 && *ws != L'\0') { @@ -252,5 +231,5 @@ wcswidth_l(const wchar_t * __restrict ws int wcswidth(const wchar_t * __restrict ws, size_t wn) { - return wcswidth_l(ws, wn, *_current_locale()); + return wcswidth_l(ws, wn, _current_locale()); } Index: src/lib/libc/locale/localeconv.c diff -u src/lib/libc/locale/localeconv.c:1.20 src/lib/libc/locale/localeconv.c:1.21 --- src/lib/libc/locale/localeconv.c:1.20 Wed Apr 17 20:40:13 2013 +++ src/lib/libc/locale/localeconv.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: localeconv.c,v 1.20 2013/04/17 20:40:13 joerg Exp $ */ +/* $NetBSD: localeconv.c,v 1.21 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c)2008 Citrus Project, @@ -28,7 +28,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: localeconv.c,v 1.20 2013/04/17 20:40:13 joerg Exp $"); +__RCSID("$NetBSD: localeconv.c,v 1.21 2013/05/17 12:55:57 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -47,7 +47,5 @@ localeconv(void) struct lconv * localeconv_l(locale_t loc) { - if (loc == NULL) - loc = _C_locale; return loc->cache->ldata; } Index: src/lib/libc/locale/multibyte_amd1.c diff -u src/lib/libc/locale/multibyte_amd1.c:1.11 src/lib/libc/locale/multibyte_amd1.c:1.12 --- src/lib/libc/locale/multibyte_amd1.c:1.11 Fri Apr 19 14:35:33 2013 +++ src/lib/libc/locale/multibyte_amd1.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: multibyte_amd1.c,v 1.11 2013/04/19 14:35:33 joerg Exp $ */ +/* $NetBSD: multibyte_amd1.c,v 1.12 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c)2002, 2008 Citrus Project, @@ -28,7 +28,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: multibyte_amd1.c,v 1.11 2013/04/19 14:35:33 joerg Exp $"); +__RCSID("$NetBSD: multibyte_amd1.c,v 1.12 2013/05/17 12:55:57 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -59,9 +59,6 @@ mbrlen_l(const char *s, size_t n, mbstat size_t ret; int err0; - if (loc == NULL) - loc = _C_locale; - _fixup_ps(_RUNE_LOCALE(loc), ps, s == NULL); err0 = _citrus_ctype_mbrlen(_ps_to_ctype(ps), s, n, @@ -75,7 +72,7 @@ mbrlen_l(const char *s, size_t n, mbstat size_t mbrlen(const char *s, size_t n, mbstate_t *ps) { - return mbrlen_l(s, n, ps, *_current_locale()); + return mbrlen_l(s, n, ps, _current_locale()); } int @@ -88,9 +85,6 @@ mbsinit_l(const mbstate_t *ps, locale_t if (ps == NULL) return 1; - if (loc == NULL) - loc = _C_locale; - if (_ps_to_runelocale(ps) == NULL) rl = _RUNE_LOCALE(loc); else @@ -108,7 +102,7 @@ mbsinit_l(const mbstate_t *ps, locale_t int mbsinit(const mbstate_t *ps) { - return mbsinit_l(ps, *_current_locale()); + return mbsinit_l(ps, _current_locale()); } size_t @@ -117,9 +111,6 @@ mbrtowc_l(wchar_t *pwc, const char *s, s size_t ret; int err0; - if (loc == NULL) - loc = _C_locale; - _fixup_ps(_RUNE_LOCALE(loc), ps, s == NULL); err0 = _citrus_ctype_mbrtowc(_ps_to_ctype(ps), pwc, s, n, @@ -133,7 +124,7 @@ mbrtowc_l(wchar_t *pwc, const char *s, s size_t mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) { - return mbrtowc_l(pwc, s, n, ps, *_current_locale()); + return mbrtowc_l(pwc, s, n, ps, _current_locale()); } size_t @@ -143,9 +134,6 @@ mbsrtowcs_l(wchar_t *pwcs, const char ** size_t ret; int err0; - if (loc == NULL) - loc = _C_locale; - _fixup_ps(_RUNE_LOCALE(loc), ps, s == NULL); err0 = _citrus_ctype_mbsrtowcs(_ps_to_ctype(ps), pwcs, s, n, @@ -159,7 +147,7 @@ mbsrtowcs_l(wchar_t *pwcs, const char ** size_t mbsrtowcs(wchar_t *pwcs, const char **s, size_t n, mbstate_t *ps) { - return mbsrtowcs_l(pwcs, s, n, ps, *_current_locale()); + return mbsrtowcs_l(pwcs, s, n, ps, _current_locale()); } size_t @@ -168,9 +156,6 @@ wcrtomb_l(char *s, wchar_t wc, mbstate_t size_t ret; int err0; - if (loc == NULL) - loc = _C_locale; - _fixup_ps(_RUNE_LOCALE(loc), ps, s == NULL); err0 = _citrus_ctype_wcrtomb(_ps_to_ctype(ps), s, wc, @@ -184,7 +169,7 @@ wcrtomb_l(char *s, wchar_t wc, mbstate_t size_t wcrtomb(char *s, wchar_t wc, mbstate_t *ps) { - return wcrtomb_l(s, wc, ps, *_current_locale()); + return wcrtomb_l(s, wc, ps, _current_locale()); } size_t @@ -194,9 +179,6 @@ wcsrtombs_l(char *s, const wchar_t **ppw size_t ret; int err0; - if (loc == NULL) - loc = _C_locale; - _fixup_ps(_RUNE_LOCALE(loc), ps, s == NULL); err0 = _citrus_ctype_wcsrtombs(_ps_to_ctype(ps), s, ppwcs, n, @@ -210,7 +192,7 @@ wcsrtombs_l(char *s, const wchar_t **ppw size_t wcsrtombs(char *s, const wchar_t **ppwcs, size_t n, mbstate_t *ps) { - return wcsrtombs_l(s, ppwcs, n, ps, *_current_locale()); + return wcsrtombs_l(s, ppwcs, n, ps, _current_locale()); } wint_t @@ -219,9 +201,6 @@ btowc_l(int c, locale_t loc) wint_t ret; int err0; - if (loc == NULL) - loc = _C_locale; - err0 = _citrus_ctype_btowc(_CITRUS_CTYPE(loc), c, &ret); if (err0) errno = err0; @@ -232,7 +211,7 @@ btowc_l(int c, locale_t loc) wint_t btowc(int c) { - return btowc_l(c, *_current_locale()); + return btowc_l(c, _current_locale()); } int @@ -241,9 +220,6 @@ wctob_l(wint_t wc, locale_t loc) int ret; int err0; - if (loc == NULL) - loc = _C_locale; - err0 = _citrus_ctype_wctob(_CITRUS_CTYPE(loc), wc, &ret); if (err0) errno = err0; @@ -254,14 +230,12 @@ wctob_l(wint_t wc, locale_t loc) int wctob(wint_t wc) { - return wctob_l(wc, *_current_locale()); + return wctob_l(wc, _current_locale()); } size_t _mb_cur_max_l(locale_t loc) { - if (loc == NULL) - loc = _C_locale; return _citrus_ctype_get_mb_cur_max(_CITRUS_CTYPE(loc)); } Index: src/lib/libc/locale/setlocale_local.h diff -u src/lib/libc/locale/setlocale_local.h:1.11 src/lib/libc/locale/setlocale_local.h:1.12 --- src/lib/libc/locale/setlocale_local.h:1.11 Sun Apr 14 23:44:54 2013 +++ src/lib/libc/locale/setlocale_local.h Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: setlocale_local.h,v 1.11 2013/04/14 23:44:54 joerg Exp $ */ +/* $NetBSD: setlocale_local.h,v 1.12 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c)2008 Citrus Project, @@ -66,7 +66,6 @@ typedef const char *(*_locale_set_t)(con __BEGIN_DECLS _locale_set_t _find_category(int); const char *_get_locale_env(const char *); -struct _locale **_current_locale(void); char *__setlocale(int, const char *); const char *_generic_LC_ALL_setlocale( @@ -85,14 +84,22 @@ const char *_citrus_LC_MESSAGES_setlocal const char * __restrict, struct _locale * __restrict); __END_DECLS +#ifdef _LIBC +extern __dso_protected struct _locale _lc_global_locale; + +static __inline struct _locale * +_current_locale(void) +{ + return &_lc_global_locale; +} + static __inline struct _locale_cache_t * _current_cache(void) { - return (*_current_locale())->cache; + return _lc_global_locale.cache; } +#endif -extern struct _locale _global_locale; -extern __dso_hidden struct _locale *_C_locale; extern size_t __mb_len_max_runtime; #endif /*_SETLOCALE_LOCAL_H_*/ Index: src/lib/libc/locale/multibyte_c90.c diff -u src/lib/libc/locale/multibyte_c90.c:1.9 src/lib/libc/locale/multibyte_c90.c:1.10 --- src/lib/libc/locale/multibyte_c90.c:1.9 Thu Apr 18 22:22:21 2013 +++ src/lib/libc/locale/multibyte_c90.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: multibyte_c90.c,v 1.9 2013/04/18 22:22:21 joerg Exp $ */ +/* $NetBSD: multibyte_c90.c,v 1.10 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c)2002, 2008 Citrus Project, @@ -28,7 +28,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: multibyte_c90.c,v 1.9 2013/04/18 22:22:21 joerg Exp $"); +__RCSID("$NetBSD: multibyte_c90.c,v 1.10 2013/05/17 12:55:57 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -55,9 +55,6 @@ mblen_l(const char *s, size_t n, locale_ int ret; int err0; - if (loc == NULL) - loc = _C_locale; - err0 = _citrus_ctype_mblen(_CITRUS_CTYPE(loc), s, n, &ret); if (err0) errno = err0; @@ -69,7 +66,7 @@ mblen_l(const char *s, size_t n, locale_ int mblen(const char *s, size_t n) { - return mblen_l(s, n, *_current_locale()); + return mblen_l(s, n, _current_locale()); } size_t @@ -78,9 +75,6 @@ mbstowcs_l(wchar_t *pwcs, const char *s, size_t ret; int err0; - if (loc == NULL) - loc = _C_locale; - err0 = _citrus_ctype_mbstowcs(_CITRUS_CTYPE(loc), pwcs, s, n, &ret); if (err0) errno = err0; @@ -91,7 +85,7 @@ mbstowcs_l(wchar_t *pwcs, const char *s, size_t mbstowcs(wchar_t *pwcs, const char *s, size_t n) { - return mbstowcs_l(pwcs, s, n, *_current_locale()); + return mbstowcs_l(pwcs, s, n, _current_locale()); } int @@ -100,9 +94,6 @@ mbtowc_l(wchar_t *pw, const char *s, siz int ret; int err0; - if (loc == NULL) - loc = _C_locale; - err0 = _citrus_ctype_mbtowc(_CITRUS_CTYPE(loc), pw, s, n, &ret); if (err0) errno = err0; @@ -113,7 +104,7 @@ mbtowc_l(wchar_t *pw, const char *s, siz int mbtowc(wchar_t *pw, const char *s, size_t n) { - return mbtowc_l(pw, s, n, *_current_locale()); + return mbtowc_l(pw, s, n, _current_locale()); } size_t @@ -122,9 +113,6 @@ wcstombs_l(char *s, const wchar_t *wcs, size_t ret; int err0; - if (loc == NULL) - loc = _C_locale; - err0 = _citrus_ctype_wcstombs(_CITRUS_CTYPE(loc), s, wcs, n, &ret); if (err0) errno = err0; @@ -135,7 +123,7 @@ wcstombs_l(char *s, const wchar_t *wcs, size_t wcstombs(char *s, const wchar_t *wcs, size_t n) { - return wcstombs_l(s, wcs, n, *_current_locale()); + return wcstombs_l(s, wcs, n, _current_locale()); } int @@ -144,9 +132,6 @@ wctomb_l(char *s, wchar_t wc, locale_t l int ret; int err0; - if (loc == NULL) - loc = _C_locale; - err0 = _citrus_ctype_wctomb(_CITRUS_CTYPE(loc), s, wc, &ret); if (err0) errno = err0; @@ -157,5 +142,5 @@ wctomb_l(char *s, wchar_t wc, locale_t l int wctomb(char *s, wchar_t wc) { - return wctomb_l(s, wc, *_current_locale()); + return wctomb_l(s, wc, _current_locale()); } Index: src/lib/libc/locale/wcsxfrm.c diff -u src/lib/libc/locale/wcsxfrm.c:1.4 src/lib/libc/locale/wcsxfrm.c:1.5 --- src/lib/libc/locale/wcsxfrm.c:1.4 Thu Apr 18 23:24:27 2013 +++ src/lib/libc/locale/wcsxfrm.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: wcsxfrm.c,v 1.4 2013/04/18 23:24:27 joerg Exp $ */ +/* $NetBSD: wcsxfrm.c,v 1.5 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c)2003 Citrus Project, @@ -28,7 +28,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: wcsxfrm.c,v 1.4 2013/04/18 23:24:27 joerg Exp $"); +__RCSID("$NetBSD: wcsxfrm.c,v 1.5 2013/05/17 12:55:57 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -46,8 +46,6 @@ wcsxfrm_l(wchar_t *s1, const wchar_t *s2 { size_t len; - if (loc == NULL) - loc = _C_locale; /* XXX: LC_COLLATE should be implemented. */ /* LINTED */(void)loc; @@ -69,5 +67,5 @@ wcsxfrm_l(wchar_t *s1, const wchar_t *s2 size_t wcsxfrm(wchar_t *s1, const wchar_t *s2, size_t n) { - return wcsxfrm_l(s1, s2, n, *_current_locale()); + return wcsxfrm_l(s1, s2, n, _current_locale()); } Index: src/lib/libc/stdio/vasprintf.c diff -u src/lib/libc/stdio/vasprintf.c:1.15 src/lib/libc/stdio/vasprintf.c:1.16 --- src/lib/libc/stdio/vasprintf.c:1.15 Fri Apr 19 15:22:25 2013 +++ src/lib/libc/stdio/vasprintf.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vasprintf.c,v 1.15 2013/04/19 15:22:25 joerg Exp $ */ +/* $NetBSD: vasprintf.c,v 1.16 2013/05/17 12:55:57 joerg Exp $ */ /* * Copyright (c) 1997 Todd C. Miller <todd.mil...@courtesan.com> @@ -29,7 +29,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vasprintf.c,v 1.15 2013/04/19 15:22:25 joerg Exp $"); +__RCSID("$NetBSD: vasprintf.c,v 1.16 2013/05/17 12:55:57 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -88,7 +88,7 @@ err: int vasprintf(char **str, const char *fmt, va_list ap) { - return vasprintf_l(str, *_current_locale(), fmt, ap); + return vasprintf_l(str, _current_locale(), fmt, ap); } int Index: src/lib/libc/stdio/vdprintf.c diff -u src/lib/libc/stdio/vdprintf.c:1.3 src/lib/libc/stdio/vdprintf.c:1.4 --- src/lib/libc/stdio/vdprintf.c:1.3 Fri Apr 19 15:22:25 2013 +++ src/lib/libc/stdio/vdprintf.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vdprintf.c,v 1.3 2013/04/19 15:22:25 joerg Exp $ */ +/* $NetBSD: vdprintf.c,v 1.4 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -34,7 +34,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vdprintf.c,v 1.3 2013/04/19 15:22:25 joerg Exp $"); +__RCSID("$NetBSD: vdprintf.c,v 1.4 2013/05/17 12:55:57 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -121,5 +121,5 @@ vdprintf_l(int fd, locale_t loc, const c int vdprintf(int fd, const char * __restrict fmt, va_list ap) { - return vdprintf_l(fd, *_current_locale(), fmt, ap); + return vdprintf_l(fd, _current_locale(), fmt, ap); } Index: src/lib/libc/stdio/vfscanf.c diff -u src/lib/libc/stdio/vfscanf.c:1.44 src/lib/libc/stdio/vfscanf.c:1.45 --- src/lib/libc/stdio/vfscanf.c:1.44 Fri Apr 19 23:32:17 2013 +++ src/lib/libc/stdio/vfscanf.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vfscanf.c,v 1.44 2013/04/19 23:32:17 joerg Exp $ */ +/* $NetBSD: vfscanf.c,v 1.45 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)vfscanf.c 8.1 (Berkeley) 6/4/93"; __FBSDID("$FreeBSD: src/lib/libc/stdio/vfscanf.c,v 1.41 2007/01/09 00:28:07 imp Exp $"); #else -__RCSID("$NetBSD: vfscanf.c,v 1.44 2013/04/19 23:32:17 joerg Exp $"); +__RCSID("$NetBSD: vfscanf.c,v 1.45 2013/05/17 12:55:57 joerg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -132,7 +132,7 @@ __collate_range_cmp(int c1, int c2, loca int __svfscanf(FILE *fp, char const *fmt0, va_list ap) { - return __svfscanf_l(fp, *_current_locale(), fmt0, ap); + return __svfscanf_l(fp, _current_locale(), fmt0, ap); } int Index: src/lib/libc/stdio/vfwprintf.c diff -u src/lib/libc/stdio/vfwprintf.c:1.31 src/lib/libc/stdio/vfwprintf.c:1.32 --- src/lib/libc/stdio/vfwprintf.c:1.31 Fri Apr 19 15:22:25 2013 +++ src/lib/libc/stdio/vfwprintf.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vfwprintf.c,v 1.31 2013/04/19 15:22:25 joerg Exp $ */ +/* $NetBSD: vfwprintf.c,v 1.32 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93"; __FBSDID("$FreeBSD: src/lib/libc/stdio/vfwprintf.c,v 1.27 2007/01/09 00:28:08 imp Exp $"); #else -__RCSID("$NetBSD: vfwprintf.c,v 1.31 2013/04/19 15:22:25 joerg Exp $"); +__RCSID("$NetBSD: vfwprintf.c,v 1.32 2013/05/17 12:55:57 joerg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -552,7 +552,7 @@ WDECL(vf,printf)(FILE * __restrict fp, c int ret; FLOCKFILE(fp); - ret = WDECL(__vf,printf_unlocked_l)(fp, *_current_locale(), fmt0, ap); + ret = WDECL(__vf,printf_unlocked_l)(fp, _current_locale(), fmt0, ap); FUNLOCKFILE(fp); return ret; } @@ -705,9 +705,6 @@ WDECL(__vf,printf_unlocked_l)(FILE *fp, static const char xdigs_lower[16] = "0123456789abcdef"; static const char xdigs_upper[16] = "0123456789ABCDEF"; - if (loc == NULL) - loc = _C_locale; - /* * BEWARE, these `goto error' on error, PRINT uses `n2' and * PAD uses `n'. Index: src/lib/libc/stdio/vfwscanf.c diff -u src/lib/libc/stdio/vfwscanf.c:1.9 src/lib/libc/stdio/vfwscanf.c:1.10 --- src/lib/libc/stdio/vfwscanf.c:1.9 Fri Apr 19 23:32:17 2013 +++ src/lib/libc/stdio/vfwscanf.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vfwscanf.c,v 1.9 2013/04/19 23:32:17 joerg Exp $ */ +/* $NetBSD: vfwscanf.c,v 1.10 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -42,7 +42,7 @@ static char sccsid[] = "@(#)ftell.c 8.2 (Berkeley) 5/4/95"; __FBSDID("$FreeBSD: src/lib/libc/stdio/vfwscanf.c,v 1.12 2004/05/02 20:13:29 obrien Exp $"); #else -__RCSID("$NetBSD: vfwscanf.c,v 1.9 2013/04/19 23:32:17 joerg Exp $"); +__RCSID("$NetBSD: vfwscanf.c,v 1.10 2013/05/17 12:55:57 joerg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -114,7 +114,7 @@ static int parsefloat(FILE *, wchar_t *, int vfwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, va_list ap) { - return vfwscanf_l(fp, *_current_locale(), fmt, ap); + return vfwscanf_l(fp, _current_locale(), fmt, ap); } int @@ -171,9 +171,6 @@ __vfwscanf_unlocked_l(FILE * __restrict static short basefix[17] = { 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; - if (loc == NULL) - loc = _C_locale; - nassigned = 0; nconversions = 0; nread = 0; Index: src/lib/libc/stdio/vsnprintf.c diff -u src/lib/libc/stdio/vsnprintf.c:1.26 src/lib/libc/stdio/vsnprintf.c:1.27 --- src/lib/libc/stdio/vsnprintf.c:1.26 Fri Apr 19 15:22:25 2013 +++ src/lib/libc/stdio/vsnprintf.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vsnprintf.c,v 1.26 2013/04/19 15:22:25 joerg Exp $ */ +/* $NetBSD: vsnprintf.c,v 1.27 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)vsnprintf.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: vsnprintf.c,v 1.26 2013/04/19 15:22:25 joerg Exp $"); +__RCSID("$NetBSD: vsnprintf.c,v 1.27 2013/05/17 12:55:57 joerg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -100,7 +100,7 @@ vsnprintf_l(char *str, size_t n, locale_ int vsnprintf(char *str, size_t n, const char *fmt, va_list ap) { - return vsnprintf_l(str, n, *_current_locale(), fmt, ap); + return vsnprintf_l(str, n, _current_locale(), fmt, ap); } int Index: src/lib/libc/stdio/vsprintf.c diff -u src/lib/libc/stdio/vsprintf.c:1.18 src/lib/libc/stdio/vsprintf.c:1.19 --- src/lib/libc/stdio/vsprintf.c:1.18 Fri Apr 19 15:22:25 2013 +++ src/lib/libc/stdio/vsprintf.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vsprintf.c,v 1.18 2013/04/19 15:22:25 joerg Exp $ */ +/* $NetBSD: vsprintf.c,v 1.19 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)vsprintf.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: vsprintf.c,v 1.18 2013/04/19 15:22:25 joerg Exp $"); +__RCSID("$NetBSD: vsprintf.c,v 1.19 2013/05/17 12:55:57 joerg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -83,7 +83,7 @@ vsprintf_l(char *str, locale_t loc, cons int vsprintf(char *str, const char *fmt, va_list ap) { - return vsprintf_l(str, *_current_locale(), fmt, ap); + return vsprintf_l(str, _current_locale(), fmt, ap); } int Index: src/lib/libc/stdio/vsscanf.c diff -u src/lib/libc/stdio/vsscanf.c:1.20 src/lib/libc/stdio/vsscanf.c:1.21 --- src/lib/libc/stdio/vsscanf.c:1.20 Fri Apr 19 23:32:17 2013 +++ src/lib/libc/stdio/vsscanf.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vsscanf.c,v 1.20 2013/04/19 23:32:17 joerg Exp $ */ +/* $NetBSD: vsscanf.c,v 1.21 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)vsscanf.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: vsscanf.c,v 1.20 2013/04/19 23:32:17 joerg Exp $"); +__RCSID("$NetBSD: vsscanf.c,v 1.21 2013/05/17 12:55:57 joerg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -85,5 +85,5 @@ vsscanf_l(const char *str, locale_t loc, int vsscanf(const char *str, const char *fmt, va_list ap) { - return vsscanf_l(str, *_current_locale(), fmt, ap); + return vsscanf_l(str, _current_locale(), fmt, ap); } Index: src/lib/libc/stdio/vswprintf.c diff -u src/lib/libc/stdio/vswprintf.c:1.4 src/lib/libc/stdio/vswprintf.c:1.5 --- src/lib/libc/stdio/vswprintf.c:1.4 Fri Apr 19 15:22:25 2013 +++ src/lib/libc/stdio/vswprintf.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vswprintf.c,v 1.4 2013/04/19 15:22:25 joerg Exp $ */ +/* $NetBSD: vswprintf.c,v 1.5 2013/05/17 12:55:57 joerg Exp $ */ /* * Copyright (c) 1997 Todd C. Miller <todd.mil...@courtesan.com> @@ -32,7 +32,7 @@ #if 0 __FBSDID("$FreeBSD: src/lib/libc/stdio/vswprintf.c,v 1.6 2005/02/21 19:41:44 fjoe Exp $"); #else -__RCSID("$NetBSD: vswprintf.c,v 1.4 2013/04/19 15:22:25 joerg Exp $"); +__RCSID("$NetBSD: vswprintf.c,v 1.5 2013/05/17 12:55:57 joerg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -109,5 +109,5 @@ int vswprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt, va_list ap) { - return vswprintf_l(s, n, *_current_locale(), fmt, ap); + return vswprintf_l(s, n, _current_locale(), fmt, ap); } Index: src/lib/libc/stdio/vswscanf.c diff -u src/lib/libc/stdio/vswscanf.c:1.11 src/lib/libc/stdio/vswscanf.c:1.12 --- src/lib/libc/stdio/vswscanf.c:1.11 Mon Apr 22 19:33:53 2013 +++ src/lib/libc/stdio/vswscanf.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vswscanf.c,v 1.11 2013/04/22 19:33:53 joerg Exp $ */ +/* $NetBSD: vswscanf.c,v 1.12 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -42,7 +42,7 @@ static char sccsid[] = "@(#)vsscanf.c 8.1 (Berkeley) 6/4/93"; __FBSDID("$FreeBSD: src/lib/libc/stdio/vswscanf.c,v 1.3 2004/04/07 09:55:05 tjr Exp $"); #else -__RCSID("$NetBSD: vswscanf.c,v 1.11 2013/04/22 19:33:53 joerg Exp $"); +__RCSID("$NetBSD: vswscanf.c,v 1.12 2013/05/17 12:55:57 joerg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -115,5 +115,5 @@ int vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt, va_list ap) { - return vswscanf_l(str, *_current_locale(), fmt, ap); + return vswscanf_l(str, _current_locale(), fmt, ap); } Index: src/lib/libc/string/strcoll.c diff -u src/lib/libc/string/strcoll.c:1.11 src/lib/libc/string/strcoll.c:1.12 --- src/lib/libc/string/strcoll.c:1.11 Fri Apr 19 23:28:47 2013 +++ src/lib/libc/string/strcoll.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: strcoll.c,v 1.11 2013/04/19 23:28:47 joerg Exp $ */ +/* $NetBSD: strcoll.c,v 1.12 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)strcoll.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: strcoll.c,v 1.11 2013/04/19 23:28:47 joerg Exp $"); +__RCSID("$NetBSD: strcoll.c,v 1.12 2013/05/17 12:55:57 joerg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -57,7 +57,7 @@ int strcoll(const char *s1, const char *s2) { - return strcoll_l(s1, s2, *_current_locale()); + return strcoll_l(s1, s2, _current_locale()); } int @@ -66,9 +66,6 @@ strcoll_l(const char *s1, const char *s2 _DIAGASSERT(s1 != NULL); _DIAGASSERT(s2 != NULL); - if (loc == NULL) - loc = _C_locale; - /* LC_COLLATE is unimplemented, hence always "C" */ /* LINTED */ (void)loc; return (strcmp(s1, s2)); Index: src/lib/libc/string/strxfrm.c diff -u src/lib/libc/string/strxfrm.c:1.13 src/lib/libc/string/strxfrm.c:1.14 --- src/lib/libc/string/strxfrm.c:1.13 Fri Apr 19 23:28:47 2013 +++ src/lib/libc/string/strxfrm.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: strxfrm.c,v 1.13 2013/04/19 23:28:47 joerg Exp $ */ +/* $NetBSD: strxfrm.c,v 1.14 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)strxfrm.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: strxfrm.c,v 1.13 2013/04/19 23:28:47 joerg Exp $"); +__RCSID("$NetBSD: strxfrm.c,v 1.14 2013/05/17 12:55:57 joerg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -62,8 +62,6 @@ strxfrm_l(char *dst, const char *src, si _DIAGASSERT(src != NULL); - if (loc == NULL) - loc = _C_locale; /* XXX: LC_COLLATE should be implemented. */ /* LINTED */(void)loc; @@ -83,5 +81,5 @@ strxfrm_l(char *dst, const char *src, si size_t strxfrm(char *dst, const char *src, size_t n) { - return strxfrm_l(dst, src, n, *_current_locale()); + return strxfrm_l(dst, src, n, _current_locale()); } Index: src/lib/libc/string/wcscasecmp.c diff -u src/lib/libc/string/wcscasecmp.c:1.3 src/lib/libc/string/wcscasecmp.c:1.4 --- src/lib/libc/string/wcscasecmp.c:1.3 Thu Apr 18 23:24:27 2013 +++ src/lib/libc/string/wcscasecmp.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: wcscasecmp.c,v 1.3 2013/04/18 23:24:27 joerg Exp $ */ +/* $NetBSD: wcscasecmp.c,v 1.4 2013/05/17 12:55:57 joerg Exp $ */ /* * Copyright (C) 2006 Aleksey Cheusov @@ -13,7 +13,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: wcscasecmp.c,v 1.3 2013/04/18 23:24:27 joerg Exp $"); +__RCSID("$NetBSD: wcscasecmp.c,v 1.4 2013/05/17 12:55:57 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -33,9 +33,6 @@ wcscasecmp_l(const wchar_t *s1, const wc int lc2 = 0; int diff = 0; - if (loc == NULL) - loc = _C_locale; - _DIAGASSERT(s1); _DIAGASSERT(s2); @@ -58,5 +55,5 @@ wcscasecmp_l(const wchar_t *s1, const wc int wcscasecmp(const wchar_t *s1, const wchar_t *s2) { - return wcscasecmp_l(s1, s2, *_current_locale()); + return wcscasecmp_l(s1, s2, _current_locale()); } Index: src/lib/libc/string/wcsncasecmp.c diff -u src/lib/libc/string/wcsncasecmp.c:1.3 src/lib/libc/string/wcsncasecmp.c:1.4 --- src/lib/libc/string/wcsncasecmp.c:1.3 Thu Apr 18 23:24:27 2013 +++ src/lib/libc/string/wcsncasecmp.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: wcsncasecmp.c,v 1.3 2013/04/18 23:24:27 joerg Exp $ */ +/* $NetBSD: wcsncasecmp.c,v 1.4 2013/05/17 12:55:57 joerg Exp $ */ /* * Copyright (C) 2006 Aleksey Cheusov @@ -13,7 +13,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: wcsncasecmp.c,v 1.3 2013/04/18 23:24:27 joerg Exp $"); +__RCSID("$NetBSD: wcsncasecmp.c,v 1.4 2013/05/17 12:55:57 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -36,9 +36,6 @@ wcsncasecmp_l(const wchar_t *s1, const w _DIAGASSERT(s1); _DIAGASSERT(s2); - if (loc == NULL) - loc = _C_locale; - while (n--) { lc1 = towlower_l(*s1, loc); lc2 = towlower_l(*s2, loc); @@ -60,5 +57,5 @@ wcsncasecmp_l(const wchar_t *s1, const w int wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n) { - return wcsncasecmp_l(s1, s2, n, *_current_locale()); + return wcsncasecmp_l(s1, s2, n, _current_locale()); } Index: src/lib/libc/time/strftime.c diff -u src/lib/libc/time/strftime.c:1.25 src/lib/libc/time/strftime.c:1.26 --- src/lib/libc/time/strftime.c:1.25 Sun Apr 21 17:45:46 2013 +++ src/lib/libc/time/strftime.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: strftime.c,v 1.25 2013/04/21 17:45:46 joerg Exp $ */ +/* $NetBSD: strftime.c,v 1.26 2013/05/17 12:55:57 joerg Exp $ */ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) @@ -6,7 +6,7 @@ static char elsieid[] = "@(#)strftime.c 7.64"; static char elsieid[] = "@(#)strftime.c 8.3"; #else -__RCSID("$NetBSD: strftime.c,v 1.25 2013/04/21 17:45:46 joerg Exp $"); +__RCSID("$NetBSD: strftime.c,v 1.26 2013/05/17 12:55:57 joerg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -111,7 +111,7 @@ size_t strftime_z(const timezone_t sp, char * __restrict s, size_t maxsize, const char * __restrict format, const struct tm * __restrict t) { - return strftime_lz(sp, s, maxsize, format, t, *_current_locale()); + return strftime_lz(sp, s, maxsize, format, t, _current_locale()); } size_t @@ -121,9 +121,6 @@ strftime_lz(const timezone_t sp, char *c char * p; int warn; - if (loc == NULL) - loc = _C_locale; - warn = IN_NONE; p = _fmt(sp, ((format == NULL) ? "%c" : format), t, s, s + maxsize, &warn, loc); Index: src/lib/libc/time/strptime.c diff -u src/lib/libc/time/strptime.c:1.37 src/lib/libc/time/strptime.c:1.38 --- src/lib/libc/time/strptime.c:1.37 Sun Apr 21 17:45:47 2013 +++ src/lib/libc/time/strptime.c Fri May 17 12:55:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: strptime.c,v 1.37 2013/04/21 17:45:47 joerg Exp $ */ +/* $NetBSD: strptime.c,v 1.38 2013/05/17 12:55:57 joerg Exp $ */ /*- * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: strptime.c,v 1.37 2013/04/21 17:45:47 joerg Exp $"); +__RCSID("$NetBSD: strptime.c,v 1.38 2013/05/17 12:55:57 joerg Exp $"); #endif #include "namespace.h" @@ -77,7 +77,7 @@ static const u_char *find_string(const u char * strptime(const char *buf, const char *fmt, struct tm *tm) { - return strptime_l(buf, fmt, tm, *_current_locale()); + return strptime_l(buf, fmt, tm, _current_locale()); } char * @@ -88,9 +88,6 @@ strptime_l(const char *buf, const char * int alt_format, i, split_year = 0, neg = 0, offs; const char *new_fmt; - if (loc == NULL) - loc = _C_locale; - bp = (const u_char *)buf; while (bp != NULL && (c = *fmt++) != '\0') {