path: root/src/internal/locale_impl.h
diff options
authorRich Felker <>2015-05-16 01:53:54 -0400
committerRich Felker <>2015-05-16 01:53:54 -0400
commit68630b55c0c7219fe9df70dc28ffbf9efc8021d8 (patch)
tree2a412da23113bfd688bbef64880e78f41222dcec /src/internal/locale_impl.h
parent707d7c30f3379441de9b320536ddfd354f4c2143 (diff)
eliminate costly tricks to avoid TLS access for current locale state
the code being removed used atomics to track whether any threads might be using a locale other than the current global locale, and whether any threads might have abstract 8-bit (non-UTF-8) LC_CTYPE active, a feature which was never committed (still pending). the motivations were to support early execution prior to setup of the thread pointer, to partially support systems (ancient kernels) where thread pointer setup is not possible, and to avoid high performance cost on archs where accessing the thread pointer may be very slow. since commit 19a1fe670acb3ab9ead0fe31859ca7d4fe40dd54, the thread pointer is always available, so these hacks are no longer needed. removing them greatly simplifies the affected code.
Diffstat (limited to 'src/internal/locale_impl.h')
1 files changed, 2 insertions, 4 deletions
diff --git a/src/internal/locale_impl.h b/src/internal/locale_impl.h
index 9142f0c2..5aebbf68 100644
--- a/src/internal/locale_impl.h
+++ b/src/internal/locale_impl.h
@@ -20,11 +20,9 @@ const char *__lctrans_cur(const char *);
#define LCTRANS(msg, lc, loc) __lctrans(msg, (loc)->cat[(lc)-2])
#define LCTRANS_CUR(msg) __lctrans_cur(msg)
- (libc.uselocale_cnt ? __pthread_self()->locale : &libc.global_locale)
+#define CURRENT_LOCALE (__pthread_self()->locale)
-#define CURRENT_UTF8 \
- (libc.bytelocale_cnt_minus_1<0 || __pthread_self()->locale->ctype_utf8)
+#define CURRENT_UTF8 (__pthread_self()->locale->ctype_utf8)
#undef MB_CUR_MAX
#define MB_CUR_MAX (CURRENT_UTF8 ? 4 : 1)