]> pd.if.org Git - pdclib/blobdiff - functions/wchar/mbrtowc.c
PDCLib includes with quotes, not <>.
[pdclib] / functions / wchar / mbrtowc.c
index 610f828c60df54ee21aa2da78fb35e1ac274a3f2..31be656a43ec368f5b079ae7e8d00140c01fe21c 100644 (file)
@@ -1,8 +1,4 @@
-/* mbrtowc(
-    wchar_t *restrict pwc, 
-    const char *restrict s, 
-    size_t n, 
-    mbstate_t *restrict ps);
+/* mbrtowc( wchar_t * pwc, const char * s, size_t n, mbstate_t * ps )
 
    This file is part of the Public Domain C Library (PDCLib).
    Permission is granted to use, modify, and / or redistribute at will.
 #include <errno.h>
 #include <stdint.h>
 #include <assert.h>
-#include <_PDCLIB_encoding.h>
-#include <_PDCLIB_locale.h>
+#include "_PDCLIB_encoding.h"
+#include "_PDCLIB_locale.h"
 
-size_t mbrtowc_l(
+static size_t mbrtowc_l(
     wchar_t    *restrict    pwc, 
     const char *restrict    s, 
     size_t                  n, 
@@ -79,13 +75,14 @@ size_t mbrtowc(
     mbstate_t *restrict ps
 )
 {
-    return mbrtowc_l(pwc, s, n, ps, _PDCLIB_threadlocale());
+    static mbstate_t st;
+    return mbrtowc_l(pwc, s, n, ps ? ps : &st, _PDCLIB_threadlocale());
 }
 
 #endif
 
 #ifdef TEST
-#include <_PDCLIB_test.h>
+#include "_PDCLIB_test.h"
 
 int main( void )
 {