]> pd.if.org Git - pdclib.old/blobdiff - internals/_PDCLIB_locale.h
Enable per-thread locale support to be compiled out
[pdclib.old] / internals / _PDCLIB_locale.h
index fd47c9ab0c4b537835d374536d20d15e9b0a70e1..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 )
@@ -80,20 +84,21 @@ typedef struct _PDCLIB_wcinfo
 } _PDCLIB_wcinfo_t;
 
 struct _PDCLIB_locale {
-    _PDCLIB_charcodec_t          _Codec;
+    const _PDCLIB_charcodec_t    _Codec;
     struct lconv                 _Conv;
 
     /* ctype / wctype */
-    _PDCLIB_wcinfo_t            *_WCType;
+    /* XXX: Maybe re-evaluate constness of these later on? */
+    const _PDCLIB_wcinfo_t      *_WCType;
     _PDCLIB_size_t               _WCTypeSize;
-    _PDCLIB_ctype_t             *_CType; 
+    const _PDCLIB_ctype_t       *_CType; 
 
     /* perror/strerror */
     char                        *_ErrnoStr[_PDCLIB_ERRNO_MAX];
 };
 
-extern _PDCLIB_wcinfo_t _PDCLIB_wcinfo[];
-extern size_t           _PDCLIB_wcinfo_size;
+extern const _PDCLIB_wcinfo_t _PDCLIB_wcinfo[];
+extern const size_t           _PDCLIB_wcinfo_size;
 
 static inline int _PDCLIB_wcinfo_cmp( const void * _key, const void * _obj )
 {