]> git.saurik.com Git - apple/libc.git/blobdiff - locale/xlocale_private.h
Libc-1044.1.2.tar.gz
[apple/libc.git] / locale / xlocale_private.h
index b4335368fa682a4a41bde60bf09b3e4ab284f727..52a4fb8fcf05bacc4a47afc1546340ee4df1d5cb 100644 (file)
@@ -41,6 +41,7 @@
 #include "lmonetary.h"
 #include "lnumeric.h"
 #include "timelocal.h"
+#include <TargetConditionals.h>
 
 #undef MB_CUR_MAX
 #define MB_CUR_MAX     (__current_locale()->__lc_ctype->__mb_cur_max)
@@ -183,9 +184,14 @@ struct _xlocale {
 #define        XL_RETAIN(x)    if ((x) && (x)->__free_extra != XPERMANENT) { OSAtomicIncrement32Barrier(&(x)->__refcount); }
 #define XL_UNLOCK(x)   UNLOCK((x)->__lock);
 
-__private_extern__ struct __xlocale_st_runelocale _DefaultRuneXLocale;
-__private_extern__ struct _xlocale     __global_locale;
-__private_extern__ pthread_key_t       __locale_key;
+__attribute__((visibility("hidden")))
+extern struct __xlocale_st_runelocale _DefaultRuneXLocale;
+
+__attribute__((visibility("hidden")))
+extern struct _xlocale __global_locale;
+
+__attribute__((visibility("hidden")))
+extern pthread_key_t   __locale_key;
 
 __BEGIN_DECLS
 
@@ -196,6 +202,15 @@ void       __xlocale_init(void);
 static inline __attribute__((always_inline)) locale_t
 __current_locale(void)
 {
+#if TARGET_IPHONE_SIMULATOR
+       /* <rdar://problem/14136256> Crash in _objc_inform for duplicate class name during simulator launch
+        * TODO: Remove after the simulator's libSystem is initialized properly.
+        */
+       if (__locale_key == (pthread_key_t)-1) {
+               return &__global_locale;
+       }
+#endif
+
        locale_t __locale = (locale_t)pthread_getspecific(__locale_key);
        return (__locale ? __locale : &__global_locale);
 }