From 21ab7f5574b22af50aa84bb2c5f4944ba8152572 Mon Sep 17 00:00:00 2001 From: theraven Date: Tue, 14 Feb 2012 14:24:37 +0000 Subject: [PATCH] Fix a misplaced __NO_TLS locations, and change a GNUism to a C11ism for consistency. Approved by: brooks (mentor) --- include/runetype.h | 2 +- lib/libc/locale/setrunelocale.c | 6 ++++-- lib/libc/locale/xlocale_private.h | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/runetype.h b/include/runetype.h index ac47db107abe..5aeea093ca13 100644 --- a/include/runetype.h +++ b/include/runetype.h @@ -86,10 +86,10 @@ typedef struct { __BEGIN_DECLS extern const _RuneLocale _DefaultRuneLocale; extern const _RuneLocale *_CurrentRuneLocale; -extern const _Thread_local _RuneLocale *_ThreadRuneLocale; #if defined(__NO_TLS) || defined(__RUNETYPE_INTERNAL) extern const _RuneLocale *__getCurrentRuneLocale(void); #else +extern const _Thread_local _RuneLocale *_ThreadRuneLocale; static inline const _RuneLocale *__getCurrentRuneLocale(void) { diff --git a/lib/libc/locale/setrunelocale.c b/lib/libc/locale/setrunelocale.c index d2e3320d82f9..bc04e9e4798b 100644 --- a/lib/libc/locale/setrunelocale.c +++ b/lib/libc/locale/setrunelocale.c @@ -183,6 +183,8 @@ __wrap_setrunelocale(const char *locale) _CurrentRuneLocale = __xlocale_global_ctype.runes; return (_LDP_LOADED); } + +#ifndef __NO_TLS void __set_thread_rune_locale(locale_t loc) { @@ -192,10 +194,11 @@ __set_thread_rune_locale(locale_t loc) { _ThreadRuneLocale = XLOCALE_CTYPE(loc)->runes; } } +#endif + void * __ctype_load(const char *locale, locale_t unused) { -#ifndef __NO_TLS struct xlocale_ctype *l = calloc(sizeof(struct xlocale_ctype), 1); l->header.header.destructor = destruct_ctype; if (__setrunelocale(l, locale)) @@ -204,5 +207,4 @@ __ctype_load(const char *locale, locale_t unused) return NULL; } return l; -#endif } diff --git a/lib/libc/locale/xlocale_private.h b/lib/libc/locale/xlocale_private.h index 01100604bd49..8b4a26d4263d 100644 --- a/lib/libc/locale/xlocale_private.h +++ b/lib/libc/locale/xlocale_private.h @@ -183,7 +183,7 @@ extern int __has_thread_locale; * The per-thread locale. Avoids the need to use pthread lookup functions when * getting the per-thread locale. */ -extern __thread locale_t __thread_locale; +extern _Thread_local locale_t __thread_locale; /** * Returns the current locale for this thread, or the global locale if none is