From 4b23f9bda30fc4aca1d0e108bab3fdbd63b0ff59 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 7 Nov 2008 15:07:10 +0000 Subject: * bits/libc-tsd.h (__libc_tsd_define, __libc_tsd_address, __libc_tsd_get, __libc_tsd_set): Add TYPE argument, use it as the type of the thread variable instead of void *. * sysdeps/mach/hurd/bits/libc-tsd.h (__libc_tsd_define, __libc_tsd_address, __libc_tsd_get, __libc_tsd_set): Likewise. * include/ctype.h (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust __libc_tsd_define arguments. (__ctype_b_loc, __ctype_toupper_loc, __ctype_tolower_loc): Adjust __libc_tsd_address arguments. Remove union hack. * include/rpc/rpc.h (RPC_VARS): Adjust __libc_tsd_define arguments. * sunrpc/rpc_thread.c (RPC_VARS): Likewise. (__rpc_thread_destroy, rpc_thread_multi, __rpc_thread_variables): Adjust __libc_tsd_{set,get} arguments. * ctype/ctype-info.c (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust __libc_tsd_define arguments. * locale/uselocale.c (__uselocale): Adjust __libc_tsd_{set,get} arguments. * locale/lc-ctype.c (_nl_postload_ctype): Likewise. * locale/global-locale.c (__libc_tsd_LOCALE): Adjust type. (LOCALE): Adjust __libc_tsd_define arguments. * locale/localeinfo.h (_NL_CURRENT_LOCALE): Adjust __libc_tsd_get arguments. (LOCALE): Adjust __libc_tsd_define arguments. * sysdeps/mach/hurd/malloc-machine.h (MALLOC): Adjust __libc_tsd_define arguments. (tsd_setspecific, tsd_getspecific): Adjust __libc_tsd_{set,get} arguments. nptl/ * sysdeps/pthread/malloc-machine.h (MALLOC): Adjust __libc_tsd_define arguments. (tsd_setspecific, tsd_getspecific): Adjust __libc_tsd_{set,get} arguments. 2008-11-07 Jakub Jelinek * bits/libc-tsd.h (__libc_tsd_define, __libc_tsd_address, __libc_tsd_get, __libc_tsd_set): Add TYPE argument, use it as the type of the thread variable instead of void *. * sysdeps/mach/hurd/bits/libc-tsd.h (__libc_tsd_define, __libc_tsd_address, __libc_tsd_get, __libc_tsd_set): Likewise. * include/ctype.h (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust __libc_tsd_define arguments. (__ctype_b_loc, __ctype_toupper_loc, __ctype_tolower_loc): Adjust __libc_tsd_address arguments. Remove union hack. * include/rpc/rpc.h (RPC_VARS): Adjust __libc_tsd_define arguments. * sunrpc/rpc_thread.c (RPC_VARS): Likewise. (__rpc_thread_destroy, rpc_thread_multi, __rpc_thread_variables): Adjust __libc_tsd_{set,get} arguments. * ctype/ctype-info.c (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust __libc_tsd_define arguments. * locale/uselocale.c (__uselocale): Adjust __libc_tsd_{set,get} arguments. * locale/lc-ctype.c (_nl_postload_ctype): Likewise. * locale/global-locale.c (__libc_tsd_LOCALE): Adjust type. (LOCALE): Adjust __libc_tsd_define arguments. * locale/localeinfo.h (_NL_CURRENT_LOCALE): Adjust __libc_tsd_get arguments. (LOCALE): Adjust __libc_tsd_define arguments. * sysdeps/mach/hurd/malloc-machine.h (MALLOC): Adjust __libc_tsd_define arguments. (tsd_setspecific, tsd_getspecific): Adjust __libc_tsd_{set,get} arguments. --- locale/global-locale.c | 6 +++--- locale/lc-ctype.c | 9 +++++---- locale/localeinfo.h | 7 ++++--- locale/uselocale.c | 12 +++++++----- 4 files changed, 19 insertions(+), 15 deletions(-) (limited to 'locale') diff --git a/locale/global-locale.c b/locale/global-locale.c index 2280f68..771742e 100644 --- a/locale/global-locale.c +++ b/locale/global-locale.c @@ -1,5 +1,5 @@ /* Locale object representing the global locale controlled by setlocale. - Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -62,9 +62,9 @@ struct __locale_struct _nl_global_locale attribute_hidden = #include #if HAVE___THREAD /* The tsd macros don't permit an initializer. */ -__thread void *__libc_tsd_LOCALE = &_nl_global_locale; +__thread __locale_t __libc_tsd_LOCALE = &_nl_global_locale; #else -__libc_tsd_define (, LOCALE) +__libc_tsd_define (, __locale_t, LOCALE) /* This is a bad kludge presuming the variable name used by the macros. Using typeof makes sure to barf if we do not match the macro definition. This ifndef is a further bad kludge for Hurd, where there is an explicit diff --git a/locale/lc-ctype.c b/locale/lc-ctype.c index a0a54fb..f2530af 100644 --- a/locale/lc-ctype.c +++ b/locale/lc-ctype.c @@ -1,5 +1,5 @@ /* Define current locale data for LC_CTYPE category. - Copyright (C) 1995,1996,1997,1998,1999,2000,2002,2003,2005 + Copyright (C) 1995,1996,1997,1998,1999,2000,2002,2003,2005,2008 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -66,10 +66,11 @@ _nl_postload_ctype (void) in fact using the global locale. */ if (_NL_CURRENT_LOCALE == &_nl_global_locale) { - __libc_tsd_set (CTYPE_B, (void *) _nl_global_locale.__ctype_b); - __libc_tsd_set (CTYPE_TOUPPER, + __libc_tsd_set (const uint16_t *, CTYPE_B, + (void *) _nl_global_locale.__ctype_b); + __libc_tsd_set (const int32_t *, CTYPE_TOUPPER, (void *) _nl_global_locale.__ctype_toupper); - __libc_tsd_set (CTYPE_TOLOWER, + __libc_tsd_set (const int32_t *, CTYPE_TOLOWER, (void *) _nl_global_locale.__ctype_tolower); } diff --git a/locale/localeinfo.h b/locale/localeinfo.h index 5e3e99c..3661080 100644 --- a/locale/localeinfo.h +++ b/locale/localeinfo.h @@ -1,5 +1,6 @@ /* Declarations for internal libc locale interfaces - Copyright (C) 1995-2003, 2005, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 1995-2003, 2005, 2006, 2007, 2008 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -203,9 +204,9 @@ extern struct __locale_struct _nl_global_locale attribute_hidden; /* This fetches the thread-local locale_t pointer, either one set with uselocale or &_nl_global_locale. */ -#define _NL_CURRENT_LOCALE ((__locale_t) __libc_tsd_get (LOCALE)) +#define _NL_CURRENT_LOCALE (__libc_tsd_get (__locale_t, LOCALE)) #include -__libc_tsd_define (extern, LOCALE) +__libc_tsd_define (extern, __locale_t, LOCALE) /* For static linking it is desireable to avoid always linking in the code diff --git a/locale/uselocale.c b/locale/uselocale.c index 6a54b58..ec5dc8f 100644 --- a/locale/uselocale.c +++ b/locale/uselocale.c @@ -1,5 +1,5 @@ /* uselocale -- fetch and set the current per-thread locale - Copyright (C) 2002, 2004, 2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2007, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -35,7 +35,7 @@ __uselocale (locale_t newloc) { const locale_t locobj = newloc == LC_GLOBAL_LOCALE ? &_nl_global_locale : newloc; - __libc_tsd_set (LOCALE, locobj); + __libc_tsd_set (__locale_t, LOCALE, locobj); #ifdef NL_CURRENT_INDIRECT /* Now we must update all the per-category thread-local variables to @@ -63,9 +63,11 @@ __uselocale (locale_t newloc) #endif /* Update the special tsd cache of some locale data. */ - __libc_tsd_set (CTYPE_B, (void *) locobj->__ctype_b); - __libc_tsd_set (CTYPE_TOLOWER, (void *) locobj->__ctype_tolower); - __libc_tsd_set (CTYPE_TOUPPER, (void *) locobj->__ctype_toupper); + __libc_tsd_set (const uint16_t *, CTYPE_B, (void *) locobj->__ctype_b); + __libc_tsd_set (const int32_t *, CTYPE_TOLOWER, + (void *) locobj->__ctype_tolower); + __libc_tsd_set (const int32_t *, CTYPE_TOUPPER, + (void *) locobj->__ctype_toupper); } return oldloc == &_nl_global_locale ? LC_GLOBAL_LOCALE : oldloc; -- cgit v1.1