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.
This commit is contained in:
Ulrich Drepper 2000-12-01 00:43:32 +00:00
parent 9a0fe6a812
commit 411adb1068
5 changed files with 48 additions and 7 deletions

View File

@ -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> 2000-11-30 Roland McGrath <roland@frob.com>
* sysdeps/mach/hurd/defs.c (init_stdio): Put this on __libc_subinit * sysdeps/mach/hurd/defs.c (init_stdio): Put this on __libc_subinit
@ -16,8 +27,7 @@
2000-11-29 Andreas Jaeger <aj@suse.de> 2000-11-29 Andreas Jaeger <aj@suse.de>
* sysdeps/unix/sysv/linux/hppa/brk.c (__brk): Remove unused * sysdeps/unix/sysv/linux/hppa/brk.c (__brk): Remove unused variable.
variable.
2000-11-28 Ulrich Drepper <drepper@redhat.com> 2000-11-28 Ulrich Drepper <drepper@redhat.com>

View File

@ -194,7 +194,7 @@ setname (int category, const char *name)
if (_nl_current_names[category] == name) if (_nl_current_names[category] == name)
return; 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]); free ((char *) _nl_current_names[category]);
_nl_current_names[category] = name; _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. */ control over the usage. So we mark it as un-deletable. */
if (newdata[category]->usage_count != UNDELETABLE) if (newdata[category]->usage_count != UNDELETABLE)
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. */ /* Create new composite name. */
@ -342,6 +350,10 @@ setlocale (int category, const char *locale)
functions know about this. */ functions know about this. */
++_nl_msg_cat_cntr; ++_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. */ /* Critical section left. */
__libc_lock_unlock (__libc_setlocale_lock); __libc_lock_unlock (__libc_setlocale_lock);
@ -376,10 +388,21 @@ setlocale (int category, const char *locale)
newdata->usage_count = UNDELETABLE; 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. */ /* Create new composite name. */
composite = new_composite_name (category, newname); composite = new_composite_name (category, newname);
if (composite == NULL) if (composite == NULL)
{ {
if (newname[0] != _nl_C_name)
free ((char *) newname[0]);
/* Say that we don't have any data loaded. */ /* Say that we don't have any data loaded. */
abort_single: abort_single:
newname[0] = NULL; newname[0] = NULL;

View 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> 2000-11-28 Ulrich Drepper <drepper@redhat.com>
* Makefile (LOCALES): Add ja_JP.SJIS. * Makefile (LOCALES): Add ja_JP.SJIS.

View File

@ -90,7 +90,7 @@ locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \
tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \ tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \
tst_wctype tst_wcwidth tst_wctype tst_wcwidth
tests = $(locale_test_suite) tst-digits tests = $(locale_test_suite) tst-digits tst-setlocale
endif endif
# Files to install. # Files to install.
@ -254,3 +254,5 @@ tst_wctrans-ENV = $(TEST_MBWC_ENV)
tst_wctype-ENV = $(TEST_MBWC_ENV) tst_wctype-ENV = $(TEST_MBWC_ENV)
tst_wcwidth-ENV = $(TEST_MBWC_ENV) tst_wcwidth-ENV = $(TEST_MBWC_ENV)
tst-digits-ENV = $(TEST_MBWC_ENV) tst-digits-ENV = $(TEST_MBWC_ENV)
tst-setlocale-ENV = LOCPATH=$(common-objpfx)localedata LC_ALL=ja_JP.EUC-JP

View File

@ -87,8 +87,7 @@
# define ISDIGIT(Ch) iswdigit (Ch) # define ISDIGIT(Ch) iswdigit (Ch)
# define ISXDIGIT(Ch) iswxdigit (Ch) # define ISXDIGIT(Ch) iswxdigit (Ch)
# define TOLOWER(Ch) towlower (Ch) # define TOLOWER(Ch) towlower (Ch)
# define ORIENT if (s->_vtable_offset == 0 && _IO_fwide (s, 1) != 1)\ # define ORIENT if (_IO_fwide (s, -1) != -1) return WEOF
return WEOF
# define __strtoll_internal __wcstoll_internal # define __strtoll_internal __wcstoll_internal
# define __strtoull_internal __wcstoull_internal # define __strtoull_internal __wcstoull_internal
# define __strtol_internal __wcstol_internal # define __strtol_internal __wcstol_internal
@ -117,7 +116,8 @@
# define ISDIGIT(Ch) isdigit (Ch) # define ISDIGIT(Ch) isdigit (Ch)
# define ISXDIGIT(Ch) isxdigit (Ch) # define ISXDIGIT(Ch) isxdigit (Ch)
# define TOLOWER(Ch) tolower (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 L_(Str) Str
# define CHAR_T char # define CHAR_T char