diff options
author | Ulrich Drepper <drepper@gmail.com> | 2011-10-15 16:27:08 -0400 |
---|---|---|
committer | Ulrich Drepper <drepper@gmail.com> | 2011-10-15 16:27:08 -0400 |
commit | fd5bdc0924e0cfd1688b632068c1b26f3b0c88da (patch) | |
tree | aac5e56322b05ae60be779de324b90087fb99dc4 /localedata | |
parent | 2d1f3a4db65d2731a695dee6b973accea8b9adc0 (diff) | |
download | glibc-fd5bdc0924e0cfd1688b632068c1b26f3b0c88da.tar glibc-fd5bdc0924e0cfd1688b632068c1b26f3b0c88da.tar.gz glibc-fd5bdc0924e0cfd1688b632068c1b26f3b0c88da.tar.bz2 glibc-fd5bdc0924e0cfd1688b632068c1b26f3b0c88da.zip |
Optimize access to isXYZ and toXYZ tables
The functions to get the pointers can now depend on the TLS variable
be initialized.
Diffstat (limited to 'localedata')
-rw-r--r-- | localedata/ChangeLog | 7 | ||||
-rw-r--r-- | localedata/Makefile | 5 | ||||
-rw-r--r-- | localedata/tst-setlocale2.c | 76 |
3 files changed, 86 insertions, 2 deletions
diff --git a/localedata/ChangeLog b/localedata/ChangeLog index e0e22070fd..dc2b8a04bb 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,10 @@ +2011-10-15 Ulrich Drepper <drepper@gmail.com> + + * Makefile (tests): Add tst-setlocale2: + (LOCALES): Add tr_TR.ISO-8859-9; + (tst-setlocale2-ENV): Define. + * tst-setlocale2.c: New file. + 2011-07-02 Roland McGrath <roland@hack.frob.com> * tests-mbwc/tst_funcs.h (TST_DECL_VARS, TST_HEAD_LOCALE): diff --git a/localedata/Makefile b/localedata/Makefile index 81c1377420..51c61a7700 100644 --- a/localedata/Makefile +++ b/localedata/Makefile @@ -94,7 +94,7 @@ locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \ tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \ tst-leaks tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \ - tst-strfmon1 tst-sscanf tst-strptime bug-setlocale1 + tst-strfmon1 tst-sscanf tst-strptime bug-setlocale1 tst-setlocale2 ifeq (yes,$(build-shared)) ifneq (no,$(PERL)) tests: $(objpfx)mtrace-tst-leaks @@ -137,7 +137,7 @@ LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 \ hr_HR.ISO-8859-2 sv_SE.ISO-8859-1 ja_JP.SJIS fr_FR.ISO-8859-1 \ vi_VN.TCVN5712-1 nb_NO.ISO-8859-1 nn_NO.ISO-8859-1 \ tr_TR.UTF-8 cs_CZ.UTF-8 zh_TW.EUC-TW fa_IR.UTF-8 fr_FR.UTF-8 \ - ja_JP.UTF-8 si_LK.UTF-8 + ja_JP.UTF-8 si_LK.UTF-8 tr_TR.ISO-8859-9 LOCALE_SRCS := $(shell echo "$(LOCALES)"|sed 's/\([^ .]*\)[^ ]*/\1/g') CHARMAPS := $(shell echo "$(LOCALES)" | \ sed -e 's/[^ .]*[.]\([^ ]*\)/\1/g' -e s/SJIS/SHIFT_JIS/g) @@ -303,6 +303,7 @@ $(objpfx)mtrace-tst-leaks: $(objpfx)tst-leaks.out bug-setlocale1-ENV = LOCPATH=$(common-objpfx)localedata bug-setlocale1-ARGS = $(common-objpfx) +tst-setlocale2-ENV = LOCPATH=$(common-objpfx)localedata $(objdir)/iconvdata/gconv-modules: $(MAKE) -C ../iconvdata subdir=iconvdata $@ diff --git a/localedata/tst-setlocale2.c b/localedata/tst-setlocale2.c new file mode 100644 index 0000000000..a4eb11fb37 --- /dev/null +++ b/localedata/tst-setlocale2.c @@ -0,0 +1,76 @@ +#include <ctype.h> +#include <locale.h> +#include <stdio.h> +#include <wctype.h> + + +static int +do_test (void) +{ + const char *loc = "de_DE.ISO-8859-1"; + if (setlocale (LC_ALL, loc) == NULL) + { + printf ("cannot set %s locale\n", loc); + return 1; + } + printf ("selected locale %s\n", loc); + + wint_t win = 0xe4; + wint_t wex = 0xc4; + wint_t wch = towupper (win); + if (wch != wex) + { + printf ("towupper(%x) = %x, expected %x\n", win, wch, wex); + return 1; + } + wch = toupper (win); + if (wch != wex) + { + printf ("toupper(%x) = %x, expected %x\n", win, wch, wex); + return 1; + } + + win = 0x69; + wex = 0x49; + wch = towupper (win); + if (wch != wex) + { + printf ("towupper(%x) = %x, expected %x\n", win, wch, wex); + return 1; + } + wch = toupper (win); + if (wch != wex) + { + printf ("toupper(%x) = %x, expected %x\n", win, wch, wex); + return 1; + } + + loc = "tr_TR.ISO-8859-9"; + if (setlocale (LC_ALL, loc) == NULL) + { + printf ("cannot set %s locale\n", loc); + return 1; + } + printf ("selected locale %s\n", loc); + + win = 0x69; + wex = 0x130; + wch = towupper (win); + if (wch != wex) + { + printf ("towupper(%x) = %x, expected %x\n", win, wch, wex); + return 1; + } + wch = toupper (win); + wex = 0xdd; + if (wch != wex) + { + printf ("toupper(%x) = %x, expected %x\n", win, wch, wex); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" |