]> pd.if.org Git - pdclib/blobdiff - functions/uchar/c32rtomb.c
PDCLib includes with quotes, not <>.
[pdclib] / functions / uchar / c32rtomb.c
index b72b7e9e8bcf6199c144640ba59f3bcb3d18dd09..19f65f1094b37a2f2a942d9291ddb70012f04000 100644 (file)
@@ -1,7 +1,4 @@
-/* c32rtomb(
-    char        *restrict   s, 
-    char32_t                c32,
-    mbstate_t   *restrict   ps);
+/* c32rtomb( char *, char32_t, mbstate_t * )
 
    This file is part of the Public Domain C Library (PDCLib).
    Permission is granted to use, modify, and / or redistribute at will.
@@ -13,8 +10,8 @@
 #include <stdint.h>
 #include <assert.h>
 #include <stdlib.h>
-#include <_PDCLIB_encoding.h>
-#include <_PDCLIB_locale.h>
+#include "_PDCLIB_encoding.h"
+#include "_PDCLIB_locale.h"
 
 size_t c32rtomb_l(
     char        *restrict   s, 
@@ -23,6 +20,9 @@ size_t c32rtomb_l(
     locale_t     restrict   l
 )
 {
+    char buf[s ? 0 : MB_CUR_MAX];
+    s =      s ? s : buf;
+
     const char32_t *restrict psrc = &c32;
     size_t srcsz  = 1;
     size_t dstsz  = MB_CUR_MAX;
@@ -49,7 +49,7 @@ size_t c32rtomb(
 #endif
 
 #ifdef TEST
-#include <_PDCLIB_test.h>
+#include "_PDCLIB_test.h"
 
 int main( void )
 {