From 68630b55c0c7219fe9df70dc28ffbf9efc8021d8 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 16 May 2015 01:53:54 -0400 Subject: 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. --- src/locale/setlocale.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/locale/setlocale.c') diff --git a/src/locale/setlocale.c b/src/locale/setlocale.c index 8ea389a3..d797f43f 100644 --- a/src/locale/setlocale.c +++ b/src/locale/setlocale.c @@ -55,12 +55,7 @@ char *setlocale(int cat, const char *name) return buf; } - if (name) { - int adj = libc.global_locale.ctype_utf8; - __setlocalecat(&libc.global_locale, cat, name); - adj -= libc.global_locale.ctype_utf8; - if (adj) a_fetch_add(&libc.bytelocale_cnt_minus_1, adj); - } + if (name) __setlocalecat(&libc.global_locale, cat, name); switch (cat) { case LC_CTYPE: -- cgit v1.2.1