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. --- ctype/Versions | 3 +++ ctype/ctype-info.c | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'ctype') diff --git a/ctype/Versions b/ctype/Versions index 8cf0338b39..84f1e2c7cb 100644 --- a/ctype/Versions +++ b/ctype/Versions @@ -21,4 +21,7 @@ libc { # functions used by optimized macros in ctype.h __ctype_b_loc; __ctype_tolower_loc; __ctype_toupper_loc; } + GLIBC_PRIVATE { + __ctype_init; + } } diff --git a/ctype/ctype-info.c b/ctype/ctype-info.c index 03b67d179f..b64e7439a8 100644 --- a/ctype/ctype-info.c +++ b/ctype/ctype-info.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,95,96,97,99,2000, 2002, 2008 +/* Copyright (C) 1991,92,95,96,97,99,2000, 2002, 2008, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -26,6 +26,19 @@ __libc_tsd_define (, const int32_t *, CTYPE_TOLOWER) __libc_tsd_define (, const int32_t *, CTYPE_TOUPPER) +void +__ctype_init (void) +{ + const uint16_t **bp = __libc_tsd_address (const uint16_t *, CTYPE_B); + *bp = (const uint16_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_CLASS) + 128; + const int32_t **up = __libc_tsd_address (const int32_t *, CTYPE_TOUPPER); + *up = ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOUPPER) + 128); + const int32_t **lp = __libc_tsd_address (const int32_t *, CTYPE_TOLOWER); + *lp = ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOLOWER) + 128); +} +libc_hidden_def (__ctype_init) + + #include #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3) -- cgit 1.4.1