X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;ds=sidebyside;f=functions%2Fwchar%2Fwcrtomb.c;h=d6ed4248a49b714e0dcb716630b247c923af8319;hb=da0f3f353d417fed71f358a48d5d5394145e460d;hp=e692923c53121d322f31f679845bb8c9b09d1ea2;hpb=5fe150c45e1bfecf7b14d17d08317436e5bc53b4;p=pdclib diff --git a/functions/wchar/wcrtomb.c b/functions/wchar/wcrtomb.c index e692923..d6ed424 100644 --- a/functions/wchar/wcrtomb.c +++ b/functions/wchar/wcrtomb.c @@ -1,7 +1,4 @@ -/* wcrtomb( - char *restrict s, - wchar_t wc, - mbstate_t *restrict ps); +/* wcrtomb( char * s, wchar_t wc, 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. @@ -13,10 +10,15 @@ #include #include #include -#include <_PDCLIB_encoding.h> -#include <_PDCLIB_locale.h> +#include "_PDCLIB_encoding.h" +#include "_PDCLIB_locale.h" -size_t wcrtomb_l( +#if 0 +/* + TODO: Other conversion functions call static ..._l helpers, but this one + does not, making this function "defined but not used". +*/ +static size_t wcrtomb_l( char *restrict s, wchar_t wc, mbstate_t *restrict ps, @@ -25,6 +27,7 @@ size_t wcrtomb_l( { return _PDCLIB_cwcrtomb_l(s, wc, ps, l); } +#endif size_t wcrtomb( char *restrict s, @@ -32,13 +35,14 @@ size_t wcrtomb( mbstate_t *restrict ps ) { - return _PDCLIB_cwcrtomb(s, wc, ps); + static mbstate_t st; + return _PDCLIB_cwcrtomb(s, wc, ps ? ps : &st); } #endif #ifdef TEST -#include <_PDCLIB_test.h> +#include "_PDCLIB_test.h" int main( void ) {