diff options
Diffstat (limited to 'src/multibyte/mbtowc.c')
-rw-r--r-- | src/multibyte/mbtowc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/multibyte/mbtowc.c b/src/multibyte/mbtowc.c index 803d2213..71a95066 100644 --- a/src/multibyte/mbtowc.c +++ b/src/multibyte/mbtowc.c @@ -4,6 +4,7 @@ * unnecessary. */ +#include <stdlib.h> #include <wchar.h> #include <errno.h> #include "internal.h" @@ -19,6 +20,7 @@ int mbtowc(wchar_t *restrict wc, const char *restrict src, size_t n) if (!wc) wc = &dummy; if (*s < 0x80) return !!(*wc = *s); + if (MB_CUR_MAX==1) return (*wc = CODEUNIT(*s)), 1; if (*s-SA > SB-SA) goto ilseq; c = bittab[*s++-SA]; |