Skip to content

Commit

Permalink
Handle LC_GLOBAL_LOCALE in duplocale.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Nov 17, 2009
1 parent 4fb9241 commit 7443244
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
2009-11-17 Ulrich Drepper <drepper@redhat.com>

[BZ #10969]
* locale/duplocale.c (__duplocale): Handle LC_GLOBAL_LOCALE special.
* locale/tst-duplocale.c: New file.
* locale/Makefile (tests): Add tst-duplocale.

[BZ #10968]
* locale/langinfo.h (_NL_LOCALE_NAME): Correct definition.
Patch by Bruno Haible <bruno@clisp.org>.
Expand Down
2 changes: 1 addition & 1 deletion locale/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ distribute = localeinfo.h categories.def iso-639.def iso-3166.def \
routines = setlocale findlocale loadlocale loadarchive \
localeconv nl_langinfo nl_langinfo_l mb_cur_max \
newlocale duplocale freelocale uselocale
tests = tst-C-locale tst-locname
tests = tst-C-locale tst-locname tst-duplocale
categories = ctype messages monetary numeric time paper name \
address telephone measurement identification collate
aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name \
Expand Down
6 changes: 5 additions & 1 deletion locale/duplocale.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Duplicate handle for selection of locales.
Copyright (C) 1997,2000,2001,2002,2005,2008 Free Software Foundation, Inc.
Copyright (C) 1997,2000-2002,2005,2008,2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
Expand Down Expand Up @@ -37,6 +37,10 @@ __duplocale (__locale_t dataset)
if (dataset == _nl_C_locobj_ptr)
return dataset;

/* Handle a special value. */
if (dataset == LC_GLOBAL_LOCALE)
dataset = &_nl_global_locale;

__locale_t result;
int cnt;
size_t names_len = 0;
Expand Down

0 comments on commit 7443244

Please sign in to comment.