diff options
Diffstat (limited to 'libc-top-half/musl/src/multibyte/mbrtoc32.c')
-rw-r--r-- | libc-top-half/musl/src/multibyte/mbrtoc32.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/multibyte/mbrtoc32.c b/libc-top-half/musl/src/multibyte/mbrtoc32.c new file mode 100644 index 0000000..9b6b236 --- /dev/null +++ b/libc-top-half/musl/src/multibyte/mbrtoc32.c @@ -0,0 +1,13 @@ +#include <uchar.h> +#include <wchar.h> + +size_t mbrtoc32(char32_t *restrict pc32, const char *restrict s, size_t n, mbstate_t *restrict ps) +{ + static unsigned internal_state; + if (!ps) ps = (void *)&internal_state; + if (!s) return mbrtoc32(0, "", 1, ps); + wchar_t wc; + size_t ret = mbrtowc(&wc, s, n, ps); + if (ret <= 4 && pc32) *pc32 = wc; + return ret; +} |