only use memcpy realloc to shrink if an exact-sized free chunk exists
[oweals/musl.git] / src / multibyte / mbrlen.c
1 #include <wchar.h>
2
3 size_t mbrlen(const char *restrict s, size_t n, mbstate_t *restrict st)
4 {
5         static unsigned internal;
6         return mbrtowc(0, s, n, st ? st : (mbstate_t *)&internal);
7 }