]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Fri, 1 Dec 2000 00:43:32 +0000 (00:43 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 1 Dec 2000 00:43:32 +0000 (00:43 +0000)
2000-11-29  H.J. Lu  <hjl@gnu.org>

* stdio-common/vfscanf.c (ORIENT): Swap the COMPILE_WSCANF case.

2000-11-30  Jakub Jelinek  <jakub@redhat.com>

* locale/setlocale.c (setname): Free for all categories, not just
LC_ALL.
(setlocale): Store a copy of string passed by user, not the string
itself.

* sysdeps/unix/sysv/linux/hppa/brk.c (__brk): Remove unused variable.

ChangeLog
locale/setlocale.c
localedata/ChangeLog
localedata/Makefile
stdio-common/vfscanf.c

index c87dc67eb9990b630063c913ca6c32714cdbdb80..aefe8bcbf2b556309ea06e543670aaf619ac3a42 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2000-11-29  H.J. Lu  <hjl@gnu.org>
+
+       * stdio-common/vfscanf.c (ORIENT): Swap the COMPILE_WSCANF case.
+
+2000-11-30  Jakub Jelinek  <jakub@redhat.com>
+
+       * locale/setlocale.c (setname): Free for all categories, not just
+       LC_ALL.
+       (setlocale): Store a copy of string passed by user, not the string
+       itself.
+
 2000-11-30  Roland McGrath  <roland@frob.com>
 
        * sysdeps/mach/hurd/defs.c (init_stdio): Put this on __libc_subinit
@@ -16,8 +27,7 @@
 
 2000-11-29  Andreas Jaeger  <aj@suse.de>
 
-       * sysdeps/unix/sysv/linux/hppa/brk.c (__brk): Remove unused
-       variable.
+       * sysdeps/unix/sysv/linux/hppa/brk.c (__brk): Remove unused variable.
 
 2000-11-28  Ulrich Drepper  <drepper@redhat.com>
 
index 3598eceac4070b3ce54612698634ae2a5925f522..c7848b9a5c275d8105663c7b8d8db2ab751d82a7 100644 (file)
@@ -194,7 +194,7 @@ setname (int category, const char *name)
   if (_nl_current_names[category] == name)
     return;
 
-  if (category == LC_ALL && _nl_current_names[category] != _nl_C_name)
+  if (_nl_current_names[category] != _nl_C_name)
     free ((char *) _nl_current_names[category]);
 
   _nl_current_names[category] = name;
@@ -322,6 +322,14 @@ setlocale (int category, const char *locale)
               control over the usage.  So we mark it as un-deletable.  */
            if (newdata[category]->usage_count != UNDELETABLE)
              newdata[category]->usage_count = UNDELETABLE;
+
+           /* Make a copy of locale name.  */
+           if (newnames[category] != _nl_C_name)
+             {
+               newnames[category] = strdup (newnames[category]);
+               if (newnames[category] == NULL)
+                 break;
+             }
          }
 
       /* Create new composite name.  */
@@ -342,6 +350,10 @@ setlocale (int category, const char *locale)
             functions know about this.  */
          ++_nl_msg_cat_cntr;
        }
+      else
+       for (++category; category < __LC_LAST; ++category)
+         if (category != LC_ALL && newnames[category] != _nl_C_name)
+           free ((char *) newnames[category]);
 
       /* Critical section left.  */
       __libc_lock_unlock (__libc_setlocale_lock);
@@ -376,10 +388,21 @@ setlocale (int category, const char *locale)
            newdata->usage_count = UNDELETABLE;
        }
 
+      /* Make a copy of locale name.  */
+      if (newname[0] != _nl_C_name)
+       {
+         newname[0] = strdup (newname[0]);
+         if (newname[0] == NULL)
+           goto abort_single;
+       }
+
       /* Create new composite name.  */
       composite = new_composite_name (category, newname);
       if (composite == NULL)
        {
+         if (newname[0] != _nl_C_name)
+           free ((char *) newname[0]);
+
          /* Say that we don't have any data loaded.  */
        abort_single:
          newname[0] = NULL;
index a745e3224ce14c341ade8093c24570e7ebba205a..238facdb2fa00499fc99aba6f32857d97d2aa1a6 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-30  Ulrich Drepper  <drepper@redhat.com>
+
+       * Makefile (tests): Add tst-setlocale.
+       (tst-setlocale-ENV): Define.
+       * tst-setlocale.c: New file.
+
 2000-11-28  Ulrich Drepper  <drepper@redhat.com>
 
        * Makefile (LOCALES): Add ja_JP.SJIS.
index 88b369834dc5489d35172972736b7b8fa0c7b04e..dc8b323b8ad63e34f38cef68136cddbe79774f29 100644 (file)
@@ -90,7 +90,7 @@ locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl            \
                     tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans      \
                     tst_wctype tst_wcwidth
 
-tests = $(locale_test_suite) tst-digits
+tests = $(locale_test_suite) tst-digits tst-setlocale
 endif
 
 # Files to install.
@@ -254,3 +254,5 @@ tst_wctrans-ENV = $(TEST_MBWC_ENV)
 tst_wctype-ENV = $(TEST_MBWC_ENV)
 tst_wcwidth-ENV = $(TEST_MBWC_ENV)
 tst-digits-ENV = $(TEST_MBWC_ENV)
+
+tst-setlocale-ENV = LOCPATH=$(common-objpfx)localedata LC_ALL=ja_JP.EUC-JP
index cf3befd39998eada8a7fe03b52b6bc1a81fa95ea..232680158098c122d05e8056765f7b1ab1f40243 100644 (file)
@@ -87,8 +87,7 @@
 #  define ISDIGIT(Ch)    iswdigit (Ch)
 #  define ISXDIGIT(Ch)   iswxdigit (Ch)
 #  define TOLOWER(Ch)    towlower (Ch)
-#  define ORIENT         if (s->_vtable_offset == 0 && _IO_fwide (s, 1) != 1)\
-                           return WEOF
+#  define ORIENT         if (_IO_fwide (s, -1) != -1) return WEOF
 #  define __strtoll_internal   __wcstoll_internal
 #  define __strtoull_internal  __wcstoull_internal
 #  define __strtol_internal    __wcstol_internal
 #  define ISDIGIT(Ch)    isdigit (Ch)
 #  define ISXDIGIT(Ch)   isxdigit (Ch)
 #  define TOLOWER(Ch)    tolower (Ch)
-#  define ORIENT         if (_IO_fwide (s, -1) != -1) return EOF
+#  define ORIENT         if (s->_vtable_offset == 0 && _IO_fwide (s, 1) != 1)\
+                           return EOF
 
 #  define L_(Str)        Str
 #  define CHAR_T         char