diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-08-18 02:46:36 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-08-18 02:46:36 +0000 |
commit | 89f29a0742e0dc8fa764a2dbb09c06e25909dac9 (patch) | |
tree | 119775c91d97fb2e9bd7833b251ac39d30577507 | |
parent | 0f4b99a643216c5ffea5bc3b2b1ae1d6940ae550 (diff) | |
download | glibc-89f29a0742e0dc8fa764a2dbb09c06e25909dac9.tar.gz glibc-89f29a0742e0dc8fa764a2dbb09c06e25909dac9.tar.xz glibc-89f29a0742e0dc8fa764a2dbb09c06e25909dac9.zip |
Update.
* locale/duplocale.c (__duplocale): Also initialize the special __ctype_* elements.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | locale/duplocale.c | 7 | ||||
-rw-r--r-- | localedata/ChangeLog | 5 | ||||
-rw-r--r-- | localedata/Makefile | 3 | ||||
-rw-r--r-- | localedata/tst-xlocale2.c | 64 |
5 files changed, 80 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index e7ff0f3918..dbf2e52dda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2001-08-17 Ulrich Drepper <drepper@redhat.com> + * locale/duplocale.c (__duplocale): Also initialize the special + __ctype_* elements. + * conform/data/netdb.h-data: Adjust gai_strerror return type. 2001-08-17 Andreas Jaeger <aj@suse.de> diff --git a/locale/duplocale.c b/locale/duplocale.c index 14eeddd627..2fe23fc6ad 100644 --- a/locale/duplocale.c +++ b/locale/duplocale.c @@ -1,5 +1,5 @@ /* Duplicate handle for selection of locales. - Copyright (C) 1997, 2000 Free Software Foundation, Inc. + Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -51,6 +51,11 @@ __duplocale (__locale_t dataset) } } + /* Update the special members. */ + result->__ctype_b = dataset->__ctype_b; + result->__ctype_tolower = dataset->__ctype_tolower; + result->__ctype_toupper = dataset->__ctype_toupper; + /* It's done. */ __libc_lock_unlock (__libc_setlocale_lock); diff --git a/localedata/ChangeLog b/localedata/ChangeLog index 63aa9ce639..96d84b0d9b 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,8 @@ +2001-08-17 Ulrich Drepper <drepper@redhat.com> + + * Makefile: Add rules to build and run tst-xlocale2. + * tst-xlocale2.c: New file. + 2001-08-14 Ulrich Drepper <drepper@redhat.com> * Makefile: Add rules to build and run tst-xlocale1. diff --git a/localedata/Makefile b/localedata/Makefile index 5380f41d4a..99819855bb 100644 --- a/localedata/Makefile +++ b/localedata/Makefile @@ -91,7 +91,7 @@ locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \ tst_wctype tst_wcwidth tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \ - tst-leaks tst-mbswcs6 tst-xlocale1 + tst-leaks tst-mbswcs6 tst-xlocale1 tst-xlocale2 ifeq (yes,$(build-shared)) ifneq (no,$(PERL)) tests: $(objpfx)mtrace-tst-leaks @@ -272,6 +272,7 @@ tst_wcwidth-ENV = $(TEST_MBWC_ENV) tst-digits-ENV = $(TEST_MBWC_ENV) tst-mbswcs6-ENV = $(TEST_MBWC_ENV) tst-xlocale1-ENV = $(TEST_MBWC_ENV) +tst-xlocale2-ENV = $(TEST_MBWC_ENV) tst-setlocale-ENV = LOCPATH=$(common-objpfx)localedata LC_ALL=ja_JP.EUC-JP diff --git a/localedata/tst-xlocale2.c b/localedata/tst-xlocale2.c new file mode 100644 index 0000000000..224cccb12f --- /dev/null +++ b/localedata/tst-xlocale2.c @@ -0,0 +1,64 @@ +#include <ctype.h> +#include <locale.h> +#include <stdio.h> +#include <stdlib.h> + + +static int do_test (__locale_t l); + +int +main (void) +{ + __locale_t l; + __locale_t l2; + int result; + + l = __newlocale (1 << LC_ALL, "de_DE.ISO-8859-1", NULL); + if (l == NULL) + { + printf ("__newlocale failed: %m\n"); + exit (EXIT_FAILURE); + } + puts ("Running tests of created locale"); + result = do_test (l); + + l2 = __duplocale (l); + if (l2 == NULL) + { + printf ("__duplocale failed: %m\n"); + exit (EXIT_FAILURE); + } + __freelocale (l); + puts ("Running tests of duplicated locale"); + result |= do_test (l2); + + return result; +} + + +static const char str[] = "0123456789abcdef ABCDEF ghijklmnopqrstuvwxyzäÄöÖüÜ"; +static const char exd[] = "11111111110000000000000000000000000000000000000000"; +static const char exa[] = "00000000001111110111111011111111111111111111111111"; +static const char exx[] = "11111111111111110111111000000000000000000000000000"; + + +static int +do_test (__locale_t l) +{ + int result = 0; + int n; + +#define DO_TEST(TEST, RES) \ + for (n = 0; n < sizeof (str) - 1; ++n) \ + if ('0' + (TEST (str[n], l) != 0) != RES[n]) \ + { \ + printf ("%s(%c) failed\n", #TEST, str[n]); \ + result = 1; \ + } + + DO_TEST (__isdigit_l, exd); + DO_TEST (__isalpha_l, exa); + DO_TEST (__isxdigit_l, exx); + + return result; +} |