summaryrefslogtreecommitdiffstats
path: root/include/runetype.h
diff options
context:
space:
mode:
authortheraven <theraven@FreeBSD.org>2012-03-04 15:31:13 +0000
committertheraven <theraven@FreeBSD.org>2012-03-04 15:31:13 +0000
commitb0968176b3a821598a31de6698e01931d1417584 (patch)
treeefbc43bd49ea1f884ea3864a768f788cee4827e7 /include/runetype.h
parent857b0ba99662198d5ba4e3609b908ede4434b182 (diff)
downloadFreeBSD-src-b0968176b3a821598a31de6698e01931d1417584.zip
FreeBSD-src-b0968176b3a821598a31de6698e01931d1417584.tar.gz
Reapply 227753 (xlocale cleanup), plus some fixes so that it passes build
universe with gcc. Approved by: dim (mentor)
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 c33ea2b..972242a 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;
+#if defined(__NO_TLS) || defined(__RUNETYPE_INTERNAL)
+extern const _RuneLocale *__getCurrentRuneLocale(void);
+#else
+extern _Thread_local const _RuneLocale *_ThreadRuneLocale;
+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
OpenPOWER on IntegriCloud