]> pd.if.org Git - pdclib/blobdiff - platform/posix/functions/_PDCLIB/_PDCLIB_stdinit.c
PDCLIB-1 (PDCLIB-3) Make wide character classification/collation information locale...
[pdclib] / platform / posix / functions / _PDCLIB / _PDCLIB_stdinit.c
index 7d246795343005361247e6805a584d28b4b1614b..0e562c6a6df8db48f1075fd749f0abf2f05b14ce 100644 (file)
@@ -18,6 +18,7 @@
 #ifndef REGTEST
 #include <_PDCLIB_io.h>
 #include <_PDCLIB_locale.h>
+#include <_PDCLIB_clocale.h>
 #include <threads.h>
 
 /* In a POSIX system, stdin / stdout / stderr are equivalent to the (int) file
@@ -79,14 +80,6 @@ FILE * stdout = &_PDCLIB_sout;
 FILE * stderr = &_PDCLIB_serr;
 
 tss_t _PDCLIB_locale_tss;
-/* Todo: Better solution than this! */
-__attribute__((constructor)) void init_stdio(void)
-{
-    tss_create(&_PDCLIB_locale_tss, (tss_dtor_t) freelocale);
-    mtx_init(&stdin->lock,  mtx_recursive);
-    mtx_init(&stdout->lock, mtx_recursive);
-    mtx_init(&stderr->lock, mtx_recursive);
-}
 
 /* FIXME: This approach is a possible attack vector. */
 FILE * _PDCLIB_filelist = &_PDCLIB_sin;
@@ -394,6 +387,16 @@ struct _PDCLIB_locale _PDCLIB_global_locale = {
     },
 };
 
+/* Todo: Better solution than this! */
+__attribute__((constructor)) void init_stdio(void)
+{
+    _PDCLIB_initclocale( &_PDCLIB_global_locale );
+    tss_create(&_PDCLIB_locale_tss, (tss_dtor_t) freelocale);
+    mtx_init(&stdin->lock,  mtx_recursive);
+    mtx_init(&stdout->lock, mtx_recursive);
+    mtx_init(&stderr->lock, mtx_recursive);
+}
+
 #endif
 
 #ifdef TEST