From fd5bdc0924e0cfd1688b632068c1b26f3b0c88da Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 15 Oct 2011 16:27:08 -0400 Subject: Optimize access to isXYZ and toXYZ tables The functions to get the pointers can now depend on the TLS variable be initialized. --- localedata/ChangeLog | 7 +++++ localedata/Makefile | 5 +-- localedata/tst-setlocale2.c | 76 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 localedata/tst-setlocale2.c (limited to 'localedata') diff --git a/localedata/ChangeLog b/localedata/ChangeLog index e0e2207..dc2b8a0 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,10 @@ +2011-10-15 Ulrich Drepper + + * 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 * tests-mbwc/tst_funcs.h (TST_DECL_VARS, TST_HEAD_LOCALE): diff --git a/localedata/Makefile b/localedata/Makefile index 81c1377..51c61a7 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 0000000..a4eb11f --- /dev/null +++ b/localedata/tst-setlocale2.c @@ -0,0 +1,76 @@ +#include +#include +#include +#include + + +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" -- cgit v1.1