From 426bf3a396d0f7743decebe861b503398400233e Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 31 Aug 2002 18:29:52 +0000 Subject: [PATCH] * locale/duplocale.c (__duplocale): Free names from the right array. * locale/uselocale.c (__uselocale): Return previous locale when setting a new one. * locale/newlocale.c: Commit changes from 2002-08-30 batch where I failed to commit this file: (__newlocale): Fill in __names array. --- ChangeLog | 11 +++++++++++ locale/duplocale.c | 4 ++-- locale/uselocale.c | 11 ++++------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index f9887ef..59306d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2002-08-31 Roland McGrath + + * locale/duplocale.c (__duplocale): Free names from the right array. + + * locale/uselocale.c (__uselocale): Return previous locale when + setting a new one. + + * locale/newlocale.c: Commit changes from 2002-08-30 + batch where I failed to commit this file: + (__newlocale): Fill in __names array. + 2002-08-31 Ulrich Drepper * sysdeps/gnu/Makefile: Only depend on Versions.v.i for diff --git a/locale/duplocale.c b/locale/duplocale.c index 0e1e673..867232e 100644 --- a/locale/duplocale.c +++ b/locale/duplocale.c @@ -56,8 +56,8 @@ __duplocale (__locale_t dataset) if (result->__names[cnt] == NULL) { while (cnt-- > 0) - if (dataset->__names[cnt] != _nl_C_name) - free ((char *) dataset->__names[cnt]); + if (result->__names[cnt] != _nl_C_name) + free ((char *) result->__names[cnt]); free (result); result = NULL; break; diff --git a/locale/uselocale.c b/locale/uselocale.c index d5e5311..d19ae50 100644 --- a/locale/uselocale.c +++ b/locale/uselocale.c @@ -28,12 +28,9 @@ locale_t __uselocale (locale_t newloc) { - if (newloc == NULL) - { - locale_t loc = __libc_tsd_get (LOCALE); - return loc == &_nl_global_locale ? LC_GLOBAL_LOCALE : loc; - } - else + locale_t oldloc = __libc_tsd_get (LOCALE); + + if (newloc != NULL) { const locale_t locobj = newloc == LC_GLOBAL_LOCALE ? &_nl_global_locale : newloc; @@ -65,6 +62,6 @@ __uselocale (locale_t newloc) #endif } - return newloc; + return oldloc == &_nl_global_locale ? LC_GLOBAL_LOCALE : oldloc; } weak_alias (__uselocale, uselocale) -- 2.7.4