aboutsummaryrefslogtreecommitdiffstats
path: root/include/runetype.h
diff options
context:
space:
mode:
authorDavid Chisnall <theraven@FreeBSD.org>2012-02-14 12:03:23 +0000
committerDavid Chisnall <theraven@FreeBSD.org>2012-02-14 12:03:23 +0000
commit82dd5016bd749d1d9e1531bd1703aebeecceab34 (patch)
treed83544c2e798a9a440baf38564df616970b2b0f5 /include/runetype.h
parent9b1246ca382e294b0905b8fe1923d80524b74937 (diff)
downloadsrc-82dd5016bd749d1d9e1531bd1703aebeecceab34.tar.gz
src-82dd5016bd749d1d9e1531bd1703aebeecceab34.zip
Cleanup of xlocale:
- Address performance regressions encountered by das@ by caching per-thread data in TLS where available. - Add a __NO_TLS flag to cdefs.h to indicate where not available. - Reorganise the xlocale.h definitions into xlocale/*.h so that they can be included from multiple places. - Export the POSIX2008 subset of xlocale when POSIX2008 says it should be exported, independently of whether xlocale.h is included. - Fix the bug where programs using ctype functions always assumed ASCII unless recompiled. - Fix some style(9) violations. Reviewed by: brooks (mentor) Approved by: dim (mentor)
Notes
Notes: svn path=/head/; revision=231673
Diffstat (limited to 'include/runetype.h')
-rw-r--r--include/runetype.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/include/runetype.h b/include/runetype.h
index c33ea2b6904f..ac47db107abe 100644
--- a/include/runetype.h
+++ b/include/runetype.h
@@ -85,11 +85,21 @@ typedef struct {
#define _RUNE_MAGIC_1 "RuneMagi" /* Indicates version 0 of RuneLocale */
__BEGIN_DECLS
extern const _RuneLocale _DefaultRuneLocale;
-__attribute__((deprecated))
-extern _RuneLocale *_CurrentRuneLocale;
-/* TODO: This is called quite a lot, so we should use a __thread variable when
- * it's available. */
-extern _RuneLocale *__getCurrentRuneLocale(void);
+extern const _RuneLocale *_CurrentRuneLocale;
+extern const _Thread_local _RuneLocale *_ThreadRuneLocale;
+#if defined(__NO_TLS) || defined(__RUNETYPE_INTERNAL)
+extern const _RuneLocale *__getCurrentRuneLocale(void);
+#else
+static inline const _RuneLocale *__getCurrentRuneLocale(void)
+{
+
+ if (_ThreadRuneLocale)
+ return _ThreadRuneLocale;
+ if (_CurrentRuneLocale)
+ return _CurrentRuneLocale;
+ return &_DefaultRuneLocale;
+}
+#endif /* __NO_TLS || __RUNETYPE_INTERNAL */
#define _CurrentRuneLocale (__getCurrentRuneLocale())
__END_DECLS