]> pd.if.org Git - pdclib.old/commitdiff
Enable per-thread locale support to be compiled out
authorOwen Shepherd <owen.shepherd@e43.eu>
Sun, 1 Sep 2013 22:12:51 +0000 (23:12 +0100)
committerOwen Shepherd <owen.shepherd@e43.eu>
Sun, 1 Sep 2013 22:12:51 +0000 (23:12 +0100)
functions/locale/uselocale.c
includes/locale.h
internals/_PDCLIB_locale.h

index 718def7f183fc76b7cd7ba05a259f6ebc21e7c9f..df5abdfbce4147d37420e22f24287c165c866371 100644 (file)
@@ -8,6 +8,7 @@
 #ifndef REGTEST
 #include <_PDCLIB_locale.h>
 
+#ifdef _PDCLIB_LOCALE_METHOD
 locale_t uselocale( locale_t newloc )
 {
     locale_t oldloc = _PDCLIB_threadlocale();
@@ -20,6 +21,7 @@ locale_t uselocale( locale_t newloc )
 
     return oldloc;
 }
+#endif
 
 #endif
 
index 3ea5e650a62cf4b8b1c5bdcf059331063ba9c9cc..a304f5e07158f6e0c4e6391579ddadc3afd183f4 100644 (file)
@@ -109,6 +109,8 @@ typedef _PDCLIB_locale_t locale_t;
 extern struct _PDCLIB_locale _PDCLIB_global_locale;
 #define LC_GLOBAL_LOCALE (&_PDCLIB_global_locale)
 
+#ifdef _PDCLIB_LOCALE_METHOD
+
 locale_t newlocale(int category_mask, const char *locale, locale_t base); 
 
 /* Set the thread locale to newlocale
@@ -129,6 +131,7 @@ locale_t duplocale(locale_t loc);
 
 /* Frees the passed locale object */
 void freelocale(locale_t loc);
+#endif
 
 #endif
 
index 3159dfb22d914548ce33324fc96d5c4be76e128d..f120748818245813655be67d5fe8b6718c0a0487 100644 (file)
 #define _PDCLIB_LOCALE_METHOD_THREAD_LOCAL  'T'
 
 #if !defined(_PDCLIB_LOCALE_METHOD)
-    #error _PDCLIB_LOCALE_METHOD undefined: don't know where I'm storing the thread locale
+    /* If undefined, no POSIX per thread locales */
+    static inline locale_t _PDCLIB_threadlocale( void )
+    {
+        return &_PDCLIB_global_locale;
+    }
 #elif _PDCLIB_LOCALE_METHOD == _PDCLIB_LOCALE_METHOD_TSS
     extern tss_t _PDCLIB_locale_tss;
     static inline locale_t _PDCLIB_threadlocale( void )