1997-02-15 04:31:36 +00:00
|
|
|
/* Return a reference to locale information record.
|
2024-01-01 18:12:26 +00:00
|
|
|
Copyright (C) 1996-2024 Free Software Foundation, Inc.
|
1997-02-15 04:31:36 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:58:11 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
1997-02-15 04:31:36 +00:00
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 04:58:11 +00:00
|
|
|
Lesser General Public License for more details.
|
1997-02-15 04:31:36 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
1997-02-15 04:31:36 +00:00
|
|
|
|
|
|
|
#include <argz.h>
|
2015-09-08 21:11:03 +00:00
|
|
|
#include <libc-lock.h>
|
1997-02-15 04:31:36 +00:00
|
|
|
#include <errno.h>
|
|
|
|
#include <locale.h>
|
|
|
|
#include <stdlib.h>
|
2002-08-31 18:28:32 +00:00
|
|
|
#include <string.h>
|
1997-02-15 04:31:36 +00:00
|
|
|
|
|
|
|
#include "localeinfo.h"
|
|
|
|
|
|
|
|
|
2004-07-16 19:06:46 +00:00
|
|
|
/* Lock for protecting global data. */
|
2008-03-31 00:38:06 +00:00
|
|
|
__libc_rwlock_define (extern , __libc_setlocale_lock attribute_hidden)
|
2004-07-16 19:06:46 +00:00
|
|
|
|
|
|
|
|
1997-02-15 04:31:36 +00:00
|
|
|
/* Use this when we come along an error. */
|
|
|
|
#define ERROR_RETURN \
|
|
|
|
do { \
|
|
|
|
__set_errno (EINVAL); \
|
|
|
|
return NULL; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
Use locale_t, not __locale_t, throughout glibc
<locale.h> is specified to define locale_t in POSIX.1-2008, and so are
all of the headers that define functions that take locale_t arguments.
Under _GNU_SOURCE, the additional headers that define such functions
have also always defined locale_t. Therefore, there is no need to use
__locale_t in public function prototypes, nor in any internal code.
* ctype/ctype-c99_l.c, ctype/ctype.h, ctype/ctype_l.c
* include/monetary.h, include/stdlib.h, include/time.h
* include/wchar.h, locale/duplocale.c, locale/freelocale.c
* locale/global-locale.c, locale/langinfo.h, locale/locale.h
* locale/localeinfo.h, locale/newlocale.c
* locale/nl_langinfo_l.c, locale/uselocale.c
* localedata/bug-usesetlocale.c, localedata/tst-xlocale2.c
* stdio-common/vfscanf.c, stdlib/monetary.h, stdlib/stdlib.h
* stdlib/strfmon_l.c, stdlib/strtod_l.c, stdlib/strtof_l.c
* stdlib/strtol.c, stdlib/strtol_l.c, stdlib/strtold_l.c
* stdlib/strtoll_l.c, stdlib/strtoul_l.c, stdlib/strtoull_l.c
* string/strcasecmp.c, string/strcoll_l.c, string/string.h
* string/strings.h, string/strncase.c, string/strxfrm_l.c
* sysdeps/ieee754/float128/strtof128_l.c
* sysdeps/ieee754/float128/wcstof128.c
* sysdeps/ieee754/float128/wcstof128_l.c
* sysdeps/ieee754/ldbl-128ibm/strtold_l.c
* sysdeps/ieee754/ldbl-64-128/strtold_l.c
* sysdeps/ieee754/ldbl-opt/nldbl-compat.c
* sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c
* sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c
* sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c
* sysdeps/powerpc/powerpc32/power7/strcasecmp.S
* sysdeps/powerpc/powerpc64/power7/strcasecmp.S
* sysdeps/x86_64/strcasecmp_l-nonascii.c
* sysdeps/x86_64/strncase_l-nonascii.c, time/strftime_l.c
* time/strptime_l.c, time/time.h, wcsmbs/mbsrtowcs_l.c
* wcsmbs/wchar.h, wcsmbs/wcscasecmp.c, wcsmbs/wcsncase.c
* wcsmbs/wcstod.c, wcsmbs/wcstod_l.c, wcsmbs/wcstof.c
* wcsmbs/wcstof_l.c, wcsmbs/wcstol_l.c, wcsmbs/wcstold.c
* wcsmbs/wcstold_l.c, wcsmbs/wcstoll_l.c, wcsmbs/wcstoul_l.c
* wcsmbs/wcstoull_l.c, wctype/iswctype_l.c
* wctype/towctrans_l.c, wctype/wcfuncs_l.c
* wctype/wctrans_l.c, wctype/wctype.h, wctype/wctype_l.c:
Change all uses of __locale_t to locale_t.
2017-06-20 13:26:43 +00:00
|
|
|
locale_t
|
|
|
|
__newlocale (int category_mask, const char *locale, locale_t base)
|
1997-02-15 04:31:36 +00:00
|
|
|
{
|
|
|
|
/* Intermediate memory for result. */
|
1999-08-31 07:04:41 +00:00
|
|
|
const char *newnames[__LC_LAST];
|
Update.
1997-03-08 05:30 Ulrich Drepper <drepper@cygnus.com>
* argp/Makefile (routines): Add argp-eexst.
* argp/argp-ba.c (argp_program_bug_address): Make `const'.
* argp/argp-eexst.c: New file. Define exit status variable.
* argp/argp-help.c (__argp_state_help): Use argp_err_exit_status
variable instead of always exiting with value 1.
* argp/argp-pv.c (argp_program_version): Make `const'.
* argp/argp.h: Declare argp_err_exit_status.
Patches by Miles Bader <miles@gnu.ai.mit.edu>.
* locale/programs/localedef.c: Use argp_err_exit_status to
terminate with correct value.
* inet/rcmd.c (iruserok): Use euidaccess instead of half-hearted
switching of UID before opening .rhosts.
* libio/vsnprintf.c: Change implementation to follow ISO C 9X
proposal. The return value now is always the number of characters
which would be written if enough space is available.
* manual/stdio.texi: Update description for new behaviour.
* locale/locale.h (__locale_t): Don't use __locale_t for struct
name and pointer to struct since old gccs cannot keep the namespaces
apart. Rename struct to __locale_struct.
* locale/duplocale.h: Likewise.
* locale/newlocale.h: Likewise.
* math/Makefile (headers): Add complex.h and cmathcalls.h.
(routines): Remove w_cabs. Add conj, cimag, creal, and cabs.
* math/math.h: Undefine __MATHDECL_1, __MATHDECL, and __MATHCALL
after use.
(signgam): Move declaration to here from mathcalls.h.
* math/mathcalls.h (cabs, __cabs_complex, signgam): Remove definition.
Correct comment for fmin and fmax.
Start implementing complex math function from ISO C 9X.
* math/complex.h: New file.
* math/cmathcalls.h: New file.
* math/cabs.c: New file.
* math/cabsf.c: New file.
* math/cabsl.c: New file.
* math/cimag.c: New file.
* math/cimagf.c: New file.
* math/cimagl.c: New file.
* math/conj.c: New file.
* math/conjf.c: New file.
* math/conjl.c: New file.
* math/creal.c: New file.
* math/crealf.c: New file.
* math/creall.c: New file.
* sysdeps/libm-ieee754/w_cabs.c: Removed.
* sysdeps/libm-ieee754/w_cabsf.c: Removed.
* sysdeps/libm-ieee754/w_cabsl.c: Removed.
* posix/regex.c: Merge with regex sources from Arnold Robbins'
version in GNU awk.
* posix/regex.h: Likewise.
Add regex test suite by Tom Lord.
* posix/Makefile (distribute): Add TESTS, TESTS2C.sed, and testcases.h.
(tests): Add runtests.
(before-compile): Add testcases.h.
(testcases.h): New rule to generate header with tests.
* posix/TESTS: New file.
* posix/TESTS2C.sed.: New file.
* posix/runtests.c: New file.
* posix/testcases.h: New file.
* sysdeps/unix/sysv/linux/poll.c: Test whether poll syscall is
available and use fall-back implementation if not.
* sysdeps/unix/sysv/linux/syscalls.list: Sort entries.
* time/ialloc.c: Update from tzcode1997c.
* time/private.h: Likewise.
* time/scheck.c: Likewise.
* time/tzselect.ksh: Likewise.
* time/zdump.c: Likewise.
* time/zic.c: Likewise.
* time/tzfile.c: Pretty print.
1997-03-06 07:37 Geoff Keating <geoffk@ozemail.com.au>
Port to powerpc-*-linux-gnu. Slightly tested, under MkLinux,
on a 601.
* sysdeps/powerpc/Implies: Added.
* sysdeps/powerpc/__longjmp.S: Added.
* sysdeps/powerpc/__math.h: Added.
* sysdeps/powerpc/bsd-_setjmp.S: Added.
* sysdeps/powerpc/bsd-setjmp.S: Added.
* sysdeps/powerpc/dl-machine.h: Added.
* sysdeps/powerpc/ffs.c: Added.
* sysdeps/powerpc/fpu_control.h: Added.
* sysdeps/powerpc/jmp_buf.h: Added.
* sysdeps/powerpc/setjmp.S: Added.
* sysdeps/powerpc/strlen.s: Added.
* sysdeps/powerpc/elf/start.c: Added.
* sysdeps/powerpc/fpu_control.h: Added.
* sysdeps/powerpc/jmp_buf.h: Added.
* sysdeps/unix/sysv/linux/powerpc/Dist: Added.
* sysdeps/unix/sysv/linux/powerpc/_exit.S: Added.
* sysdeps/unix/sysv/linux/powerpc/brk.c: Added.
* sysdeps/unix/sysv/linux/powerpc/clone.S: Added.
* sysdeps/unix/sysv/linux/powerpc/init-first.h: Added.
* sysdeps/unix/sysv/linux/powerpc/ioctl-types.h: Added.
* sysdeps/unix/sysv/linux/powerpc/profil.c: Added.
* sysdeps/unix/sysv/linux/powerpc/sigreturn.S: Added.
* sysdeps/unix/sysv/linux/powerpc/socket.S: Added.
* sysdeps/unix/sysv/linux/powerpc/syscall.S: Added.
* sysdeps/unix/sysv/linux/powerpc/syscalls.list: Added.
* sysdeps/unix/sysv/linux/powerpc/sysdep.c: Added.
* sysdeps/unix/sysv/linux/powerpc/sysdep.h: Added.
* sysdeps/unix/sysv/linux/powerpc/termbits.h: Added.
* sysdeps/unix/sysv/linux/powerpc/sys/syscall.h: Added.
1997-03-05 05:24 Geoff Keating <geoffk@ozemail.com.au>
* elf/dl-runtime.c (fixup): Add ELF_FIXUP_RETURNS_ADDRESS switch,
because knowing the first instruction of a PowerPC PLT trampoline
is not very helpful.
1997-03-04 08:04 Geoff Keating <geoffk@ozemail.com.au>
* elf/dl-load.c (ELF_PREFERRED_ADDRESS, ELF_PREFERRED_ADDRESS_DATA,
ELF_FIXED_ADDRESS): Added. These are for dl-machine.h to indicate
a preference as to where executables should be loaded.
1997-02-28 08:50 Geoff Keating <geoffk@ozemail.com.au>
* elf/elf.h: Add in all those PowerPC reloc types.
1997-02-24 07:12 Geoff Keating <geoffk@ozemail.com.au>
* stdio-common/vfscanf.c: Use __va_copy if available.
1997-03-06 13:50 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* malloc/malloc.c (mprotect) [_LIBC]: Define as __mprotect to
clean up namespace.
1997-03-07 14:27 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/libm-ieee754/s_fpclassify.c (__fpclassify): Don't use
non-existing GET_WORDS macro, use EXTRACT_WORDS.
Reported by Andres Schwab <schwab@issan.informatik.uni-dortmund.de>.
1997-03-07 05:27 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/i386/sigaction.c: The user- and
kernel-level sigaction structure is different. handle this
correctly.
Bug report by Andres Jaeger <jaeger@informatik.uni-kl.de>.
1997-03-06 05:55 David Engel <david@sw.ods.com>
* sysdeps/generic/dl-cache.c (_dl_load_cache_lookup): Also
recognize cache entries with flag == 3.
1997-03-06 01:05 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/generic/netinet/in.h (INADDR_NONE): Cast to unsigned int.
(INADDR_LOOPBACK): Likewise.
* sysdeps/unix/sysv/linux/netinet/in.h: Likewise.
* manual/socket.texi: Correct types of INADDR_* constants from
unsigned long to unsigned.
1997-03-05 23:14 Ulrich Drepper <drepper@cygnus.com>
* time/antarctica: Update from tzdata1997c.
* time/asia: Likewise.
* time/zone.tab: Likewise.
1997-03-05 00:43 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* configure.in (libc_cv_asm_symver_directive,
libc_cv_ld_version_script_option): Remove unknown instruction from
assembler test file.
1997-03-04 19:14 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/m68k/fpu/__math.h: Update feature tests to use
__USE_ISOC9X.
[__USE_ISOC9X]: Define __log2 and __exp2 inlines.
(fabs): Remove defininition, it is a gcc builtin.
(sqrt, __sqrt): Remove definition, they have wrappers in libm.
1997-03-04 10:11 H.J. Lu <hjl@lucon.org>
* sunrpc/Makefile ($(objpfx)rpc-proto.c): Create subdir before
generating file.
1997-03-05 03:59 Ulrich Drepper <drepper@cygnus.com>
* inet/rcmd.c (__ivaliduser): Don't use getline, but __getline
instead to avoid namespace problems.
Reported by David Mosberger-Tang <davidm@AZStarNet.COM>.
1997-03-03 19:01 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* login/utmp_file.c: Fix previous change. Make portable by
checking the _HAVE_UT_* feature macros.
* libio/fileops.c (_IO_file_finish): Likewise.
1997-03-08 05:28:20 +00:00
|
|
|
struct __locale_struct result;
|
Use locale_t, not __locale_t, throughout glibc
<locale.h> is specified to define locale_t in POSIX.1-2008, and so are
all of the headers that define functions that take locale_t arguments.
Under _GNU_SOURCE, the additional headers that define such functions
have also always defined locale_t. Therefore, there is no need to use
__locale_t in public function prototypes, nor in any internal code.
* ctype/ctype-c99_l.c, ctype/ctype.h, ctype/ctype_l.c
* include/monetary.h, include/stdlib.h, include/time.h
* include/wchar.h, locale/duplocale.c, locale/freelocale.c
* locale/global-locale.c, locale/langinfo.h, locale/locale.h
* locale/localeinfo.h, locale/newlocale.c
* locale/nl_langinfo_l.c, locale/uselocale.c
* localedata/bug-usesetlocale.c, localedata/tst-xlocale2.c
* stdio-common/vfscanf.c, stdlib/monetary.h, stdlib/stdlib.h
* stdlib/strfmon_l.c, stdlib/strtod_l.c, stdlib/strtof_l.c
* stdlib/strtol.c, stdlib/strtol_l.c, stdlib/strtold_l.c
* stdlib/strtoll_l.c, stdlib/strtoul_l.c, stdlib/strtoull_l.c
* string/strcasecmp.c, string/strcoll_l.c, string/string.h
* string/strings.h, string/strncase.c, string/strxfrm_l.c
* sysdeps/ieee754/float128/strtof128_l.c
* sysdeps/ieee754/float128/wcstof128.c
* sysdeps/ieee754/float128/wcstof128_l.c
* sysdeps/ieee754/ldbl-128ibm/strtold_l.c
* sysdeps/ieee754/ldbl-64-128/strtold_l.c
* sysdeps/ieee754/ldbl-opt/nldbl-compat.c
* sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c
* sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c
* sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c
* sysdeps/powerpc/powerpc32/power7/strcasecmp.S
* sysdeps/powerpc/powerpc64/power7/strcasecmp.S
* sysdeps/x86_64/strcasecmp_l-nonascii.c
* sysdeps/x86_64/strncase_l-nonascii.c, time/strftime_l.c
* time/strptime_l.c, time/time.h, wcsmbs/mbsrtowcs_l.c
* wcsmbs/wchar.h, wcsmbs/wcscasecmp.c, wcsmbs/wcsncase.c
* wcsmbs/wcstod.c, wcsmbs/wcstod_l.c, wcsmbs/wcstof.c
* wcsmbs/wcstof_l.c, wcsmbs/wcstol_l.c, wcsmbs/wcstold.c
* wcsmbs/wcstold_l.c, wcsmbs/wcstoll_l.c, wcsmbs/wcstoul_l.c
* wcsmbs/wcstoull_l.c, wctype/iswctype_l.c
* wctype/towctrans_l.c, wctype/wcfuncs_l.c
* wctype/wctrans_l.c, wctype/wctype.h, wctype/wctype_l.c:
Change all uses of __locale_t to locale_t.
2017-06-20 13:26:43 +00:00
|
|
|
locale_t result_ptr;
|
1997-02-15 04:31:36 +00:00
|
|
|
char *locale_path;
|
|
|
|
size_t locale_path_len;
|
|
|
|
const char *locpath_var;
|
|
|
|
int cnt;
|
2002-08-31 20:08:18 +00:00
|
|
|
size_t names_len;
|
1997-02-15 04:31:36 +00:00
|
|
|
|
|
|
|
/* We treat LC_ALL in the same way as if all bits were set. */
|
2001-01-20 01:49:21 +00:00
|
|
|
if (category_mask == 1 << LC_ALL)
|
1999-08-31 07:04:41 +00:00
|
|
|
category_mask = (1 << __LC_LAST) - 1 - (1 << LC_ALL);
|
1997-02-15 04:31:36 +00:00
|
|
|
|
|
|
|
/* Sanity check for CATEGORY argument. */
|
Update.
2000-07-24 Jakub Jelinek <jakub@redhat.com>
* libio/wfiledoalloc.c (_IO_wfile_doallocate): Measure size
in wide characters, not bytes.
* libio/tst_putwc.c (do_test): Add test for writing lots of data
into file.
2000-07-22 Bruno Haible <haible@clisp.cons.org>
* locale/nl_langinfo.c (nl_langinfo): Accept items belonging to the
new categories LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE,
LC_MEASUREMENT, LC_IDENTIFICATION.
* locale/xlocale.h (struct __locale_struct): Increase size of
__locales array.
* locale/duplocale.c (__duplocale): Copy newly added categories as
well.
* locale/freelocale.c (__freelocale): Free newly added categories.
* locale/newlocale.c (__newlocale): Fix typo in sanity check.
If a base is given, use it, don't simply return it.
2000-07-22 Bruno Haible <haible@clisp.cons.org>
* crypt/md5-crypt.c (__md5_crypt_r): Avoid gcc warnings: Use pointer
variables, copied_key and copied_salt, instead of boolean variables.
2000-07-24 21:03:16 +00:00
|
|
|
if ((category_mask & ~((1 << __LC_LAST) - 1 - (1 << LC_ALL))) != 0)
|
1997-02-15 04:31:36 +00:00
|
|
|
ERROR_RETURN;
|
|
|
|
|
|
|
|
/* `newlocale' does not support asking for the locale name. */
|
|
|
|
if (locale == NULL)
|
|
|
|
ERROR_RETURN;
|
|
|
|
|
2005-12-21 07:28:33 +00:00
|
|
|
if (base == _nl_C_locobj_ptr)
|
2002-10-11 07:22:18 +00:00
|
|
|
/* We're to modify BASE, returned for a previous call with "C".
|
|
|
|
We can't really modify the read-only structure, so instead
|
|
|
|
start over by copying it. */
|
|
|
|
base = NULL;
|
|
|
|
|
|
|
|
if ((base == NULL || category_mask == (1 << __LC_LAST) - 1 - (1 << LC_ALL))
|
|
|
|
&& (category_mask == 0 || !strcmp (locale, "C")))
|
|
|
|
/* Asking for the "C" locale needn't allocate a new object. */
|
2005-12-21 07:28:33 +00:00
|
|
|
return _nl_C_locobj_ptr;
|
2002-10-11 07:22:18 +00:00
|
|
|
|
1997-02-15 04:31:36 +00:00
|
|
|
/* Allocate memory for the result. */
|
|
|
|
if (base != NULL)
|
Update.
2000-07-24 Jakub Jelinek <jakub@redhat.com>
* libio/wfiledoalloc.c (_IO_wfile_doallocate): Measure size
in wide characters, not bytes.
* libio/tst_putwc.c (do_test): Add test for writing lots of data
into file.
2000-07-22 Bruno Haible <haible@clisp.cons.org>
* locale/nl_langinfo.c (nl_langinfo): Accept items belonging to the
new categories LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE,
LC_MEASUREMENT, LC_IDENTIFICATION.
* locale/xlocale.h (struct __locale_struct): Increase size of
__locales array.
* locale/duplocale.c (__duplocale): Copy newly added categories as
well.
* locale/freelocale.c (__freelocale): Free newly added categories.
* locale/newlocale.c (__newlocale): Fix typo in sanity check.
If a base is given, use it, don't simply return it.
2000-07-22 Bruno Haible <haible@clisp.cons.org>
* crypt/md5-crypt.c (__md5_crypt_r): Avoid gcc warnings: Use pointer
variables, copied_key and copied_salt, instead of boolean variables.
2000-07-24 21:03:16 +00:00
|
|
|
result = *base;
|
1997-02-15 04:31:36 +00:00
|
|
|
else
|
* locale/setlocale.c (_nl_current_names): Variable moved ...
* locale/localename.c (_nl_current_names): ... here, new file.
Make it global, with attribute_hidden.
* locale/localeinfo.h: Declare it.
* locale/Makefile (aux): Add localename.
* locale/localename.c (__current_locale_name): New function.
* include/locale.h (__current_locale_name): Declare it.
* intl/dcigettext.c (guess_category_value): Use that instead of
calling setlocale.
* locale/locale.h [__USE_GNU] (locale_t): New type alias of __locale_t.
[__USE_GNU] (newlocale, duplocale, freelocale, uselocale): New decls.
[__USE_GNU] (LC_GLOBAL_LOCALE): New macro.
* locale/newlocale.c: Add alias to __ name.
* locale/duplocale.c: Likewise.
* locale/freelocale.c: Likewise.
* locale/uselocale.c: New file.
* locale/Makefile (routines): Add it.
* locale/Versions (libc: GLIBC_2.3): New set.
Add newlocale, duplocale, freelocale, uselocale.
(libc: GLIBC_PRIVATE): Add __uselocale.
* locale/localeinfo.h [SHARED]
(_NL_CURRENT_LOCALE): New macro, defined to fetch a tsd value.
(_NL_CURRENT_DATA): Define using that.
(_NL_CURRENT, _NL_CURRENT_WSTR, _NL_CURRENT_WORD): Define using that.
(_NL_CURRENT_DEFINE): Define to empty.
[! SHARED]: Decls of _nl_current_CATEGORY and _nl_current
conditionalized on this.
* locale/xlocale.c (NL_C_INTIIALIZER): New macro,
taking initializer of _nl_C_locobj.
[SHARED] (_nl_global_locale): New variable, using that initializer.
(_nl_C_locobj): Use new macro for initialzier.
* locale/setlocale.c [! SHARED] (_nl_current): Conditionalize on this.
[! SHARED] (CATEGORY_USED): New macro.
[SHARED] (CATEGORY_USED, _nl_C): New macros.
(setdata, setlocale): Use that macro instead of examining _nl_current.
(setdata): Set the slot in _nl_global_locale.
Conditionalize setting of _nl_current on [! SHARED].
* locale/findlocale.c [SHARED] (_nl_C): Define as a macro instead of
declaration as an extern.
* locale/newlocale.c (__newlocale): Use _nl_C_locobj instead of _nl_C.
* include/locale.h: Use libc_hidden_proto for setlocale.
* locale/setlocale.c: Add libc_hidden_def.
* locale/setlocale.c (free_mem): Use _NL_CURRENT_DATA.
2002-08-04 01:41:55 +00:00
|
|
|
/* Fill with pointers to C locale data. */
|
|
|
|
result = _nl_C_locobj;
|
1997-02-15 04:31:36 +00:00
|
|
|
|
Update.
2000-07-24 Jakub Jelinek <jakub@redhat.com>
* libio/wfiledoalloc.c (_IO_wfile_doallocate): Measure size
in wide characters, not bytes.
* libio/tst_putwc.c (do_test): Add test for writing lots of data
into file.
2000-07-22 Bruno Haible <haible@clisp.cons.org>
* locale/nl_langinfo.c (nl_langinfo): Accept items belonging to the
new categories LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE,
LC_MEASUREMENT, LC_IDENTIFICATION.
* locale/xlocale.h (struct __locale_struct): Increase size of
__locales array.
* locale/duplocale.c (__duplocale): Copy newly added categories as
well.
* locale/freelocale.c (__freelocale): Free newly added categories.
* locale/newlocale.c (__newlocale): Fix typo in sanity check.
If a base is given, use it, don't simply return it.
2000-07-22 Bruno Haible <haible@clisp.cons.org>
* crypt/md5-crypt.c (__md5_crypt_r): Avoid gcc warnings: Use pointer
variables, copied_key and copied_salt, instead of boolean variables.
2000-07-24 21:03:16 +00:00
|
|
|
/* If no category is to be set we return BASE if available or a
|
|
|
|
dataset using the C locale data. */
|
|
|
|
if (category_mask == 0)
|
|
|
|
{
|
Use locale_t, not __locale_t, throughout glibc
<locale.h> is specified to define locale_t in POSIX.1-2008, and so are
all of the headers that define functions that take locale_t arguments.
Under _GNU_SOURCE, the additional headers that define such functions
have also always defined locale_t. Therefore, there is no need to use
__locale_t in public function prototypes, nor in any internal code.
* ctype/ctype-c99_l.c, ctype/ctype.h, ctype/ctype_l.c
* include/monetary.h, include/stdlib.h, include/time.h
* include/wchar.h, locale/duplocale.c, locale/freelocale.c
* locale/global-locale.c, locale/langinfo.h, locale/locale.h
* locale/localeinfo.h, locale/newlocale.c
* locale/nl_langinfo_l.c, locale/uselocale.c
* localedata/bug-usesetlocale.c, localedata/tst-xlocale2.c
* stdio-common/vfscanf.c, stdlib/monetary.h, stdlib/stdlib.h
* stdlib/strfmon_l.c, stdlib/strtod_l.c, stdlib/strtof_l.c
* stdlib/strtol.c, stdlib/strtol_l.c, stdlib/strtold_l.c
* stdlib/strtoll_l.c, stdlib/strtoul_l.c, stdlib/strtoull_l.c
* string/strcasecmp.c, string/strcoll_l.c, string/string.h
* string/strings.h, string/strncase.c, string/strxfrm_l.c
* sysdeps/ieee754/float128/strtof128_l.c
* sysdeps/ieee754/float128/wcstof128.c
* sysdeps/ieee754/float128/wcstof128_l.c
* sysdeps/ieee754/ldbl-128ibm/strtold_l.c
* sysdeps/ieee754/ldbl-64-128/strtold_l.c
* sysdeps/ieee754/ldbl-opt/nldbl-compat.c
* sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c
* sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c
* sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c
* sysdeps/powerpc/powerpc32/power7/strcasecmp.S
* sysdeps/powerpc/powerpc64/power7/strcasecmp.S
* sysdeps/x86_64/strcasecmp_l-nonascii.c
* sysdeps/x86_64/strncase_l-nonascii.c, time/strftime_l.c
* time/strptime_l.c, time/time.h, wcsmbs/mbsrtowcs_l.c
* wcsmbs/wchar.h, wcsmbs/wcscasecmp.c, wcsmbs/wcsncase.c
* wcsmbs/wcstod.c, wcsmbs/wcstod_l.c, wcsmbs/wcstof.c
* wcsmbs/wcstof_l.c, wcsmbs/wcstol_l.c, wcsmbs/wcstold.c
* wcsmbs/wcstold_l.c, wcsmbs/wcstoll_l.c, wcsmbs/wcstoul_l.c
* wcsmbs/wcstoull_l.c, wctype/iswctype_l.c
* wctype/towctrans_l.c, wctype/wcfuncs_l.c
* wctype/wctrans_l.c, wctype/wctype.h, wctype/wctype_l.c:
Change all uses of __locale_t to locale_t.
2017-06-20 13:26:43 +00:00
|
|
|
result_ptr = (locale_t) malloc (sizeof (struct __locale_struct));
|
Update.
2000-07-24 Jakub Jelinek <jakub@redhat.com>
* libio/wfiledoalloc.c (_IO_wfile_doallocate): Measure size
in wide characters, not bytes.
* libio/tst_putwc.c (do_test): Add test for writing lots of data
into file.
2000-07-22 Bruno Haible <haible@clisp.cons.org>
* locale/nl_langinfo.c (nl_langinfo): Accept items belonging to the
new categories LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE,
LC_MEASUREMENT, LC_IDENTIFICATION.
* locale/xlocale.h (struct __locale_struct): Increase size of
__locales array.
* locale/duplocale.c (__duplocale): Copy newly added categories as
well.
* locale/freelocale.c (__freelocale): Free newly added categories.
* locale/newlocale.c (__newlocale): Fix typo in sanity check.
If a base is given, use it, don't simply return it.
2000-07-22 Bruno Haible <haible@clisp.cons.org>
* crypt/md5-crypt.c (__md5_crypt_r): Avoid gcc warnings: Use pointer
variables, copied_key and copied_salt, instead of boolean variables.
2000-07-24 21:03:16 +00:00
|
|
|
if (result_ptr == NULL)
|
|
|
|
return NULL;
|
|
|
|
*result_ptr = result;
|
1997-02-15 04:31:36 +00:00
|
|
|
|
Update.
2000-07-24 Jakub Jelinek <jakub@redhat.com>
* libio/wfiledoalloc.c (_IO_wfile_doallocate): Measure size
in wide characters, not bytes.
* libio/tst_putwc.c (do_test): Add test for writing lots of data
into file.
2000-07-22 Bruno Haible <haible@clisp.cons.org>
* locale/nl_langinfo.c (nl_langinfo): Accept items belonging to the
new categories LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE,
LC_MEASUREMENT, LC_IDENTIFICATION.
* locale/xlocale.h (struct __locale_struct): Increase size of
__locales array.
* locale/duplocale.c (__duplocale): Copy newly added categories as
well.
* locale/freelocale.c (__freelocale): Free newly added categories.
* locale/newlocale.c (__newlocale): Fix typo in sanity check.
If a base is given, use it, don't simply return it.
2000-07-22 Bruno Haible <haible@clisp.cons.org>
* crypt/md5-crypt.c (__md5_crypt_r): Avoid gcc warnings: Use pointer
variables, copied_key and copied_salt, instead of boolean variables.
2000-07-24 21:03:16 +00:00
|
|
|
goto update;
|
1997-02-15 04:31:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* We perhaps really have to load some data. So we determine the
|
|
|
|
path in which to look for the data now. The environment variable
|
|
|
|
`LOCPATH' must only be used when the binary has no SUID or SGID
|
* locale/loadarchive.c (_nl_load_locale_from_archive): Parse locale
name to find codeset name (if any) and normalize it. If the
normalized name differs, look up only that in the archive.
* locale/programs/locarchive.c (add_locale_to_archive): If the name
contains a codeset, normalize the codeset store only the normalized
name in the archive. If not, add an alias containing the locale's
normalized codeset name. Apply codeset name normalization when
matching entries in the alias file.
* locale/programs/locarchive.c (delete_locales_from_archive): Don't
decrement HEAD->namehash_used here.
(add_locale): Only need to insert name string when name_offset != 0.
* locale/programs/localedef.c (options): Add -A/--alias-file.
(alias_file): New variable.
(parse_opt): Grok -A, set that.
* locale/programs/localedef.h: Declare it.
* locale/programs/locarchive.c (insert_name): New function, broken out
of ...
(add_locale_to_archive): ... here. Call that.
(add_alias): New function.
(add_locale): New static function, add_locale_to_archive renamed.
(add_locale_to_archive): Call that and use add_alias to add an alias
for the name with codeset if the given name lacks it.
(enlarge_archive): Call add_locale instead of add_locale_to_archive.
* locale/Makefile (routines): Add loadarchive.
* locale/loadarchive.c: New file, started from code by Ulrich Drepper.
(_nl_load_locale_from_archive): New function.
* locale/localeinfo.h: Declare it.
* locale/findlocale.c (_nl_find_locale): If using default locale path,
try _nl_load_locale_from_archive first.
* locale/loadlocale.c (_nl_intern_locale_data): New function,
broken out of _nl_load_locale.
(_nl_load_locale): Call that.
* locale/localeinfo.h: Declare it.
(struct locale_data): Replace member `mmaped' with `alloc', an enum.
(struct locale_data): Remove unused member `options'.
* locale/findlocale.c (_nl_remove_locale): Update uses.
* locale/loadlocale.c (_nl_load_locale, _nl_unload_locale): Likewise.
* locale/C-collate.c: Update initializer.
* locale/C-identification.c: Likewise.
* locale/C-measurement.c: Likewise.
* locale/C-telephone.c: Likewise.
* locale/C-address.c: Likewise.
* locale/C-name.c: Likewise.
* locale/C-paper.c: Likewise.
* locale/C-time.c: Likewise.
* locale/C-numeric.c: Likewise.
* locale/C-monetary.c: Likewise.
* locale/C-messages.c : Likewise.
* locale/C-ctype.c: Likewise.
* locale/hashval.h [! LONGBITS]: Include <limits.h> here and
use CHAR_BIT instead of BITSPERBYTE.
* locale/localeinfo.h (_nl_find_locale, _nl_load_locale,
_nl_unload_locale): Add `internal_function attribute_hidden' to decls.
* locale/findlocale.c (_nl_find_locale): Add internal_function to defn.
(_nl_remove_locale): Likewise.
* locale/loadlocale.c (_nl_load_locale, _nl_unload_locale): Likewise.
* locale/findlocale.c (_nl_default_locale_path): New variable.
(_nl_find_locale): If LOCALE_PATH is null, default to that.
* locale/localeinfo.h: Declare it.
* locale/setlocale.c (setlocale): Use _nl_default_locale_path
in place of LOCALEDIR. If no LOCPATH, pass null to _nl_find_locale.
* locale/newlocale.c (__newlocale): Likewise.
* misc/err.c (vwarnx, vwarn): Fix typos in libc_hidden_def uses.
* inet/rexec.c (rexec_af): Add libc_hidden_def.
* sysdeps/generic/morecore.c: Likewise.
* signal/allocrtsig.c (__libc_current_sigrtmin): Likewise.
(__libc_current_sigrtmax): Likewise.
2002-08-08 Roland McGrath <roland@redhat.com>
* locale/loadlocale.c (_nl_load_locale): Don't use MAP_INHERIT.
* catgets/open_catalog.c (__open_catalog): Likewise.
* locale/programs/locarchive.c (INITIAL_NUM_NAMES): Renamed
from typo INITIAL_NUM_NANES.
(create_archive): Update use.
2002-08-10 06:22:37 +00:00
|
|
|
bit set. If using the default path, we tell _nl_find_locale
|
|
|
|
by passing null and it can check the canonical locale archive. */
|
1997-02-15 04:31:36 +00:00
|
|
|
locale_path = NULL;
|
|
|
|
locale_path_len = 0;
|
|
|
|
|
2000-09-26 09:46:55 +00:00
|
|
|
locpath_var = getenv ("LOCPATH");
|
1997-02-15 04:31:36 +00:00
|
|
|
if (locpath_var != NULL && locpath_var[0] != '\0')
|
* locale/loadarchive.c (_nl_load_locale_from_archive): Parse locale
name to find codeset name (if any) and normalize it. If the
normalized name differs, look up only that in the archive.
* locale/programs/locarchive.c (add_locale_to_archive): If the name
contains a codeset, normalize the codeset store only the normalized
name in the archive. If not, add an alias containing the locale's
normalized codeset name. Apply codeset name normalization when
matching entries in the alias file.
* locale/programs/locarchive.c (delete_locales_from_archive): Don't
decrement HEAD->namehash_used here.
(add_locale): Only need to insert name string when name_offset != 0.
* locale/programs/localedef.c (options): Add -A/--alias-file.
(alias_file): New variable.
(parse_opt): Grok -A, set that.
* locale/programs/localedef.h: Declare it.
* locale/programs/locarchive.c (insert_name): New function, broken out
of ...
(add_locale_to_archive): ... here. Call that.
(add_alias): New function.
(add_locale): New static function, add_locale_to_archive renamed.
(add_locale_to_archive): Call that and use add_alias to add an alias
for the name with codeset if the given name lacks it.
(enlarge_archive): Call add_locale instead of add_locale_to_archive.
* locale/Makefile (routines): Add loadarchive.
* locale/loadarchive.c: New file, started from code by Ulrich Drepper.
(_nl_load_locale_from_archive): New function.
* locale/localeinfo.h: Declare it.
* locale/findlocale.c (_nl_find_locale): If using default locale path,
try _nl_load_locale_from_archive first.
* locale/loadlocale.c (_nl_intern_locale_data): New function,
broken out of _nl_load_locale.
(_nl_load_locale): Call that.
* locale/localeinfo.h: Declare it.
(struct locale_data): Replace member `mmaped' with `alloc', an enum.
(struct locale_data): Remove unused member `options'.
* locale/findlocale.c (_nl_remove_locale): Update uses.
* locale/loadlocale.c (_nl_load_locale, _nl_unload_locale): Likewise.
* locale/C-collate.c: Update initializer.
* locale/C-identification.c: Likewise.
* locale/C-measurement.c: Likewise.
* locale/C-telephone.c: Likewise.
* locale/C-address.c: Likewise.
* locale/C-name.c: Likewise.
* locale/C-paper.c: Likewise.
* locale/C-time.c: Likewise.
* locale/C-numeric.c: Likewise.
* locale/C-monetary.c: Likewise.
* locale/C-messages.c : Likewise.
* locale/C-ctype.c: Likewise.
* locale/hashval.h [! LONGBITS]: Include <limits.h> here and
use CHAR_BIT instead of BITSPERBYTE.
* locale/localeinfo.h (_nl_find_locale, _nl_load_locale,
_nl_unload_locale): Add `internal_function attribute_hidden' to decls.
* locale/findlocale.c (_nl_find_locale): Add internal_function to defn.
(_nl_remove_locale): Likewise.
* locale/loadlocale.c (_nl_load_locale, _nl_unload_locale): Likewise.
* locale/findlocale.c (_nl_default_locale_path): New variable.
(_nl_find_locale): If LOCALE_PATH is null, default to that.
* locale/localeinfo.h: Declare it.
* locale/setlocale.c (setlocale): Use _nl_default_locale_path
in place of LOCALEDIR. If no LOCPATH, pass null to _nl_find_locale.
* locale/newlocale.c (__newlocale): Likewise.
* misc/err.c (vwarnx, vwarn): Fix typos in libc_hidden_def uses.
* inet/rexec.c (rexec_af): Add libc_hidden_def.
* sysdeps/generic/morecore.c: Likewise.
* signal/allocrtsig.c (__libc_current_sigrtmin): Likewise.
(__libc_current_sigrtmax): Likewise.
2002-08-08 Roland McGrath <roland@redhat.com>
* locale/loadlocale.c (_nl_load_locale): Don't use MAP_INHERIT.
* catgets/open_catalog.c (__open_catalog): Likewise.
* locale/programs/locarchive.c (INITIAL_NUM_NAMES): Renamed
from typo INITIAL_NUM_NANES.
(create_archive): Update use.
2002-08-10 06:22:37 +00:00
|
|
|
{
|
|
|
|
if (__argz_create_sep (locpath_var, ':',
|
|
|
|
&locale_path, &locale_path_len) != 0)
|
|
|
|
return NULL;
|
1997-02-15 04:31:36 +00:00
|
|
|
|
* locale/loadarchive.c (_nl_load_locale_from_archive): Parse locale
name to find codeset name (if any) and normalize it. If the
normalized name differs, look up only that in the archive.
* locale/programs/locarchive.c (add_locale_to_archive): If the name
contains a codeset, normalize the codeset store only the normalized
name in the archive. If not, add an alias containing the locale's
normalized codeset name. Apply codeset name normalization when
matching entries in the alias file.
* locale/programs/locarchive.c (delete_locales_from_archive): Don't
decrement HEAD->namehash_used here.
(add_locale): Only need to insert name string when name_offset != 0.
* locale/programs/localedef.c (options): Add -A/--alias-file.
(alias_file): New variable.
(parse_opt): Grok -A, set that.
* locale/programs/localedef.h: Declare it.
* locale/programs/locarchive.c (insert_name): New function, broken out
of ...
(add_locale_to_archive): ... here. Call that.
(add_alias): New function.
(add_locale): New static function, add_locale_to_archive renamed.
(add_locale_to_archive): Call that and use add_alias to add an alias
for the name with codeset if the given name lacks it.
(enlarge_archive): Call add_locale instead of add_locale_to_archive.
* locale/Makefile (routines): Add loadarchive.
* locale/loadarchive.c: New file, started from code by Ulrich Drepper.
(_nl_load_locale_from_archive): New function.
* locale/localeinfo.h: Declare it.
* locale/findlocale.c (_nl_find_locale): If using default locale path,
try _nl_load_locale_from_archive first.
* locale/loadlocale.c (_nl_intern_locale_data): New function,
broken out of _nl_load_locale.
(_nl_load_locale): Call that.
* locale/localeinfo.h: Declare it.
(struct locale_data): Replace member `mmaped' with `alloc', an enum.
(struct locale_data): Remove unused member `options'.
* locale/findlocale.c (_nl_remove_locale): Update uses.
* locale/loadlocale.c (_nl_load_locale, _nl_unload_locale): Likewise.
* locale/C-collate.c: Update initializer.
* locale/C-identification.c: Likewise.
* locale/C-measurement.c: Likewise.
* locale/C-telephone.c: Likewise.
* locale/C-address.c: Likewise.
* locale/C-name.c: Likewise.
* locale/C-paper.c: Likewise.
* locale/C-time.c: Likewise.
* locale/C-numeric.c: Likewise.
* locale/C-monetary.c: Likewise.
* locale/C-messages.c : Likewise.
* locale/C-ctype.c: Likewise.
* locale/hashval.h [! LONGBITS]: Include <limits.h> here and
use CHAR_BIT instead of BITSPERBYTE.
* locale/localeinfo.h (_nl_find_locale, _nl_load_locale,
_nl_unload_locale): Add `internal_function attribute_hidden' to decls.
* locale/findlocale.c (_nl_find_locale): Add internal_function to defn.
(_nl_remove_locale): Likewise.
* locale/loadlocale.c (_nl_load_locale, _nl_unload_locale): Likewise.
* locale/findlocale.c (_nl_default_locale_path): New variable.
(_nl_find_locale): If LOCALE_PATH is null, default to that.
* locale/localeinfo.h: Declare it.
* locale/setlocale.c (setlocale): Use _nl_default_locale_path
in place of LOCALEDIR. If no LOCPATH, pass null to _nl_find_locale.
* locale/newlocale.c (__newlocale): Likewise.
* misc/err.c (vwarnx, vwarn): Fix typos in libc_hidden_def uses.
* inet/rexec.c (rexec_af): Add libc_hidden_def.
* sysdeps/generic/morecore.c: Likewise.
* signal/allocrtsig.c (__libc_current_sigrtmin): Likewise.
(__libc_current_sigrtmax): Likewise.
2002-08-08 Roland McGrath <roland@redhat.com>
* locale/loadlocale.c (_nl_load_locale): Don't use MAP_INHERIT.
* catgets/open_catalog.c (__open_catalog): Likewise.
* locale/programs/locarchive.c (INITIAL_NUM_NAMES): Renamed
from typo INITIAL_NUM_NANES.
(create_archive): Update use.
2002-08-10 06:22:37 +00:00
|
|
|
if (__argz_add_sep (&locale_path, &locale_path_len,
|
|
|
|
_nl_default_locale_path, ':') != 0)
|
|
|
|
return NULL;
|
|
|
|
}
|
1997-02-15 04:31:36 +00:00
|
|
|
|
|
|
|
/* Get the names for the locales we are interested in. We either
|
|
|
|
allow a composite name or a single name. */
|
1999-08-31 07:04:41 +00:00
|
|
|
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
|
|
|
if (cnt != LC_ALL)
|
|
|
|
newnames[cnt] = locale;
|
1997-02-15 04:31:36 +00:00
|
|
|
if (strchr (locale, ';') != NULL)
|
|
|
|
{
|
|
|
|
/* This is a composite name. Make a copy and split it up. */
|
|
|
|
char *np = strdupa (locale);
|
|
|
|
char *cp;
|
* inet/getnetgrent_r.c (endnetgrent, __getnetgrent_r): Actually call
the static symbols added in the last change (doofus is me).
* locale/newlocale.c (__newlocale): Use a bit mask instead of a second
loop to notice missing categories in a composite name.
* locale/locale.h (LC_CTYPE_MASK, LC_NUMERIC_MASK, LC_TIME_MASK,
LC_COLLATE_MASK, LC_MONETARY_MASK, LC_MESSAGES_MASK, LC_ALL_MASK,
LC_PAPER_MASK, LC_NAME_MASK, LC_ADDRESS_MASK, LC_TELEPHONE_MASK,
LC_MEASUREMENT_MASK, LC_IDENTIFICATION_MASK, LC_ALL_MASK): New macros.
* malloc/tst-calloc.c: Add tests for one or both parameters being zero.
2002-08-08 01:33:05 +00:00
|
|
|
int specified_mask = 0;
|
1997-02-15 04:31:36 +00:00
|
|
|
|
|
|
|
while ((cp = strchr (np, '=')) != NULL)
|
|
|
|
{
|
1999-08-31 07:04:41 +00:00
|
|
|
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
|
|
|
if (cnt != LC_ALL
|
|
|
|
&& (size_t) (cp - np) == _nl_category_name_sizes[cnt]
|
2019-09-05 20:16:58 +00:00
|
|
|
&& memcmp (np, (_nl_category_names_get (cnt)), cp - np) == 0)
|
1997-02-15 04:31:36 +00:00
|
|
|
break;
|
|
|
|
|
1999-08-31 07:04:41 +00:00
|
|
|
if (cnt == __LC_LAST)
|
1997-02-15 04:31:36 +00:00
|
|
|
/* Bogus category name. */
|
|
|
|
ERROR_RETURN;
|
|
|
|
|
|
|
|
/* Found the category this clause sets. */
|
* inet/getnetgrent_r.c (endnetgrent, __getnetgrent_r): Actually call
the static symbols added in the last change (doofus is me).
* locale/newlocale.c (__newlocale): Use a bit mask instead of a second
loop to notice missing categories in a composite name.
* locale/locale.h (LC_CTYPE_MASK, LC_NUMERIC_MASK, LC_TIME_MASK,
LC_COLLATE_MASK, LC_MONETARY_MASK, LC_MESSAGES_MASK, LC_ALL_MASK,
LC_PAPER_MASK, LC_NAME_MASK, LC_ADDRESS_MASK, LC_TELEPHONE_MASK,
LC_MEASUREMENT_MASK, LC_IDENTIFICATION_MASK, LC_ALL_MASK): New macros.
* malloc/tst-calloc.c: Add tests for one or both parameters being zero.
2002-08-08 01:33:05 +00:00
|
|
|
specified_mask |= 1 << cnt;
|
1997-02-15 04:31:36 +00:00
|
|
|
newnames[cnt] = ++cp;
|
|
|
|
cp = strchr (cp, ';');
|
|
|
|
if (cp != NULL)
|
|
|
|
{
|
|
|
|
/* Examine the next clause. */
|
|
|
|
*cp = '\0';
|
|
|
|
np = cp + 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
/* This was the last clause. We are done. */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
* inet/getnetgrent_r.c (endnetgrent, __getnetgrent_r): Actually call
the static symbols added in the last change (doofus is me).
* locale/newlocale.c (__newlocale): Use a bit mask instead of a second
loop to notice missing categories in a composite name.
* locale/locale.h (LC_CTYPE_MASK, LC_NUMERIC_MASK, LC_TIME_MASK,
LC_COLLATE_MASK, LC_MONETARY_MASK, LC_MESSAGES_MASK, LC_ALL_MASK,
LC_PAPER_MASK, LC_NAME_MASK, LC_ADDRESS_MASK, LC_TELEPHONE_MASK,
LC_MEASUREMENT_MASK, LC_IDENTIFICATION_MASK, LC_ALL_MASK): New macros.
* malloc/tst-calloc.c: Add tests for one or both parameters being zero.
2002-08-08 01:33:05 +00:00
|
|
|
if (category_mask &~ specified_mask)
|
|
|
|
/* The composite name did not specify all categories we need. */
|
|
|
|
ERROR_RETURN;
|
1997-02-15 04:31:36 +00:00
|
|
|
}
|
|
|
|
|
2004-07-16 19:06:46 +00:00
|
|
|
/* Protect global data. */
|
2008-03-31 00:38:06 +00:00
|
|
|
__libc_rwlock_wrlock (__libc_setlocale_lock);
|
2004-07-16 19:06:46 +00:00
|
|
|
|
1997-02-15 04:31:36 +00:00
|
|
|
/* Now process all categories we are interested in. */
|
2002-08-31 20:08:18 +00:00
|
|
|
names_len = 0;
|
1999-08-31 07:04:41 +00:00
|
|
|
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
2002-08-31 20:08:18 +00:00
|
|
|
{
|
|
|
|
if ((category_mask & 1 << cnt) != 0)
|
|
|
|
{
|
|
|
|
result.__locales[cnt] = _nl_find_locale (locale_path,
|
|
|
|
locale_path_len,
|
|
|
|
cnt, &newnames[cnt]);
|
|
|
|
if (result.__locales[cnt] == NULL)
|
|
|
|
{
|
|
|
|
free_cnt_data_and_exit:
|
|
|
|
while (cnt-- > 0)
|
|
|
|
if (((category_mask & 1 << cnt) != 0)
|
|
|
|
&& result.__locales[cnt]->usage_count != UNDELETABLE)
|
|
|
|
/* We can remove the data. */
|
|
|
|
_nl_remove_locale (cnt, result.__locales[cnt]);
|
2004-07-16 19:06:46 +00:00
|
|
|
|
|
|
|
/* Critical section left. */
|
2008-03-31 00:38:06 +00:00
|
|
|
__libc_rwlock_unlock (__libc_setlocale_lock);
|
2002-08-31 20:08:18 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (newnames[cnt] != _nl_C_name)
|
|
|
|
names_len += strlen (newnames[cnt]) + 1;
|
|
|
|
}
|
|
|
|
else if (cnt != LC_ALL && result.__names[cnt] != _nl_C_name)
|
|
|
|
/* Tally up the unchanged names from BASE as well. */
|
|
|
|
names_len += strlen (result.__names[cnt]) + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We successfully loaded all required data. Allocate a new structure.
|
|
|
|
We can't just reuse the BASE pointer, because the name strings are
|
|
|
|
changing and we need the old name string area intact so we can copy
|
|
|
|
out of it into the new one without overlap problems should some
|
|
|
|
category's name be getting longer. */
|
|
|
|
result_ptr = malloc (sizeof (struct __locale_struct) + names_len);
|
|
|
|
if (result_ptr == NULL)
|
|
|
|
{
|
|
|
|
cnt = __LC_LAST;
|
|
|
|
goto free_cnt_data_and_exit;
|
|
|
|
}
|
1997-02-15 04:31:36 +00:00
|
|
|
|
|
|
|
if (base == NULL)
|
|
|
|
{
|
2002-08-31 20:08:18 +00:00
|
|
|
/* Fill in this new structure from scratch. */
|
|
|
|
|
|
|
|
char *namep = (char *) (result_ptr + 1);
|
1997-02-15 04:31:36 +00:00
|
|
|
|
2002-08-31 20:08:18 +00:00
|
|
|
/* Install copied new names in the new structure's __names array.
|
2002-08-31 19:00:15 +00:00
|
|
|
If resolved to "C", that is already in RESULT.__names to start. */
|
2002-08-31 18:28:32 +00:00
|
|
|
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
2002-08-31 19:00:15 +00:00
|
|
|
if ((category_mask & 1 << cnt) != 0 && newnames[cnt] != _nl_C_name)
|
2002-08-31 18:28:32 +00:00
|
|
|
{
|
2002-08-31 20:08:18 +00:00
|
|
|
result.__names[cnt] = namep;
|
|
|
|
namep = __stpcpy (namep, newnames[cnt]) + 1;
|
2002-08-31 18:28:32 +00:00
|
|
|
}
|
2002-08-31 19:00:15 +00:00
|
|
|
|
|
|
|
*result_ptr = result;
|
1997-02-15 04:31:36 +00:00
|
|
|
}
|
|
|
|
else
|
2002-08-31 18:28:32 +00:00
|
|
|
{
|
2002-08-31 20:08:18 +00:00
|
|
|
/* We modify the base structure. */
|
2002-08-31 18:28:32 +00:00
|
|
|
|
2002-08-31 20:08:18 +00:00
|
|
|
char *namep = (char *) (result_ptr + 1);
|
2002-08-31 18:28:32 +00:00
|
|
|
|
|
|
|
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
2002-08-31 19:00:15 +00:00
|
|
|
if ((category_mask & 1 << cnt) != 0)
|
2002-08-31 18:28:32 +00:00
|
|
|
{
|
2002-08-31 19:00:15 +00:00
|
|
|
if (base->__locales[cnt]->usage_count != UNDELETABLE)
|
|
|
|
/* We can remove the old data. */
|
|
|
|
_nl_remove_locale (cnt, base->__locales[cnt]);
|
2002-08-31 20:08:18 +00:00
|
|
|
result_ptr->__locales[cnt] = result.__locales[cnt];
|
2002-08-31 19:00:15 +00:00
|
|
|
|
2002-08-31 20:08:18 +00:00
|
|
|
if (newnames[cnt] == _nl_C_name)
|
|
|
|
result_ptr->__names[cnt] = _nl_C_name;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
result_ptr->__names[cnt] = namep;
|
|
|
|
namep = __stpcpy (namep, newnames[cnt]) + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (cnt != LC_ALL)
|
|
|
|
{
|
|
|
|
/* The RESULT members point into the old BASE structure. */
|
|
|
|
result_ptr->__locales[cnt] = result.__locales[cnt];
|
|
|
|
if (result.__names[cnt] == _nl_C_name)
|
|
|
|
result_ptr->__names[cnt] = _nl_C_name;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
result_ptr->__names[cnt] = namep;
|
|
|
|
namep = __stpcpy (namep, result.__names[cnt]) + 1;
|
|
|
|
}
|
2002-08-31 18:28:32 +00:00
|
|
|
}
|
|
|
|
|
2002-08-31 20:08:18 +00:00
|
|
|
free (base);
|
2002-08-31 18:28:32 +00:00
|
|
|
}
|
2001-08-14 23:29:55 +00:00
|
|
|
|
2004-07-16 19:06:46 +00:00
|
|
|
/* Critical section left. */
|
2008-03-31 00:38:06 +00:00
|
|
|
__libc_rwlock_unlock (__libc_setlocale_lock);
|
2004-07-16 19:06:46 +00:00
|
|
|
|
1997-02-15 04:31:36 +00:00
|
|
|
/* Update the special members. */
|
|
|
|
update:
|
|
|
|
{
|
|
|
|
union locale_data_value *ctypes = result_ptr->__locales[LC_CTYPE]->values;
|
Update.
2000-07-24 Jakub Jelinek <jakub@redhat.com>
* libio/wfiledoalloc.c (_IO_wfile_doallocate): Measure size
in wide characters, not bytes.
* libio/tst_putwc.c (do_test): Add test for writing lots of data
into file.
2000-07-22 Bruno Haible <haible@clisp.cons.org>
* locale/nl_langinfo.c (nl_langinfo): Accept items belonging to the
new categories LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE,
LC_MEASUREMENT, LC_IDENTIFICATION.
* locale/xlocale.h (struct __locale_struct): Increase size of
__locales array.
* locale/duplocale.c (__duplocale): Copy newly added categories as
well.
* locale/freelocale.c (__freelocale): Free newly added categories.
* locale/newlocale.c (__newlocale): Fix typo in sanity check.
If a base is given, use it, don't simply return it.
2000-07-22 Bruno Haible <haible@clisp.cons.org>
* crypt/md5-crypt.c (__md5_crypt_r): Avoid gcc warnings: Use pointer
variables, copied_key and copied_salt, instead of boolean variables.
2000-07-24 21:03:16 +00:00
|
|
|
result_ptr->__ctype_b = (const unsigned short int *)
|
2001-04-11 01:07:57 +00:00
|
|
|
ctypes[_NL_ITEM_INDEX (_NL_CTYPE_CLASS)].string + 128;
|
Update.
2000-07-24 Jakub Jelinek <jakub@redhat.com>
* libio/wfiledoalloc.c (_IO_wfile_doallocate): Measure size
in wide characters, not bytes.
* libio/tst_putwc.c (do_test): Add test for writing lots of data
into file.
2000-07-22 Bruno Haible <haible@clisp.cons.org>
* locale/nl_langinfo.c (nl_langinfo): Accept items belonging to the
new categories LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE,
LC_MEASUREMENT, LC_IDENTIFICATION.
* locale/xlocale.h (struct __locale_struct): Increase size of
__locales array.
* locale/duplocale.c (__duplocale): Copy newly added categories as
well.
* locale/freelocale.c (__freelocale): Free newly added categories.
* locale/newlocale.c (__newlocale): Fix typo in sanity check.
If a base is given, use it, don't simply return it.
2000-07-22 Bruno Haible <haible@clisp.cons.org>
* crypt/md5-crypt.c (__md5_crypt_r): Avoid gcc warnings: Use pointer
variables, copied_key and copied_salt, instead of boolean variables.
2000-07-24 21:03:16 +00:00
|
|
|
result_ptr->__ctype_tolower = (const int *)
|
2001-04-11 01:07:57 +00:00
|
|
|
ctypes[_NL_ITEM_INDEX (_NL_CTYPE_TOLOWER)].string + 128;
|
Update.
2000-07-24 Jakub Jelinek <jakub@redhat.com>
* libio/wfiledoalloc.c (_IO_wfile_doallocate): Measure size
in wide characters, not bytes.
* libio/tst_putwc.c (do_test): Add test for writing lots of data
into file.
2000-07-22 Bruno Haible <haible@clisp.cons.org>
* locale/nl_langinfo.c (nl_langinfo): Accept items belonging to the
new categories LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE,
LC_MEASUREMENT, LC_IDENTIFICATION.
* locale/xlocale.h (struct __locale_struct): Increase size of
__locales array.
* locale/duplocale.c (__duplocale): Copy newly added categories as
well.
* locale/freelocale.c (__freelocale): Free newly added categories.
* locale/newlocale.c (__newlocale): Fix typo in sanity check.
If a base is given, use it, don't simply return it.
2000-07-22 Bruno Haible <haible@clisp.cons.org>
* crypt/md5-crypt.c (__md5_crypt_r): Avoid gcc warnings: Use pointer
variables, copied_key and copied_salt, instead of boolean variables.
2000-07-24 21:03:16 +00:00
|
|
|
result_ptr->__ctype_toupper = (const int *)
|
2001-04-11 01:07:57 +00:00
|
|
|
ctypes[_NL_ITEM_INDEX (_NL_CTYPE_TOUPPER)].string + 128;
|
1997-02-15 04:31:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return result_ptr;
|
|
|
|
}
|
* locale/setlocale.c (_nl_current_names): Variable moved ...
* locale/localename.c (_nl_current_names): ... here, new file.
Make it global, with attribute_hidden.
* locale/localeinfo.h: Declare it.
* locale/Makefile (aux): Add localename.
* locale/localename.c (__current_locale_name): New function.
* include/locale.h (__current_locale_name): Declare it.
* intl/dcigettext.c (guess_category_value): Use that instead of
calling setlocale.
* locale/locale.h [__USE_GNU] (locale_t): New type alias of __locale_t.
[__USE_GNU] (newlocale, duplocale, freelocale, uselocale): New decls.
[__USE_GNU] (LC_GLOBAL_LOCALE): New macro.
* locale/newlocale.c: Add alias to __ name.
* locale/duplocale.c: Likewise.
* locale/freelocale.c: Likewise.
* locale/uselocale.c: New file.
* locale/Makefile (routines): Add it.
* locale/Versions (libc: GLIBC_2.3): New set.
Add newlocale, duplocale, freelocale, uselocale.
(libc: GLIBC_PRIVATE): Add __uselocale.
* locale/localeinfo.h [SHARED]
(_NL_CURRENT_LOCALE): New macro, defined to fetch a tsd value.
(_NL_CURRENT_DATA): Define using that.
(_NL_CURRENT, _NL_CURRENT_WSTR, _NL_CURRENT_WORD): Define using that.
(_NL_CURRENT_DEFINE): Define to empty.
[! SHARED]: Decls of _nl_current_CATEGORY and _nl_current
conditionalized on this.
* locale/xlocale.c (NL_C_INTIIALIZER): New macro,
taking initializer of _nl_C_locobj.
[SHARED] (_nl_global_locale): New variable, using that initializer.
(_nl_C_locobj): Use new macro for initialzier.
* locale/setlocale.c [! SHARED] (_nl_current): Conditionalize on this.
[! SHARED] (CATEGORY_USED): New macro.
[SHARED] (CATEGORY_USED, _nl_C): New macros.
(setdata, setlocale): Use that macro instead of examining _nl_current.
(setdata): Set the slot in _nl_global_locale.
Conditionalize setting of _nl_current on [! SHARED].
* locale/findlocale.c [SHARED] (_nl_C): Define as a macro instead of
declaration as an extern.
* locale/newlocale.c (__newlocale): Use _nl_C_locobj instead of _nl_C.
* include/locale.h: Use libc_hidden_proto for setlocale.
* locale/setlocale.c: Add libc_hidden_def.
* locale/setlocale.c (free_mem): Use _NL_CURRENT_DATA.
2002-08-04 01:41:55 +00:00
|
|
|
weak_alias (__newlocale, newlocale)
|