projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
generalize mips-specific reloc code not to hard-code sym/type encoding
[musl]
/
src
/
multibyte
/
mbtowc.c
diff --git
a/src/multibyte/mbtowc.c
b/src/multibyte/mbtowc.c
index
6710637
..
71a9506
100644
(file)
--- a/
src/multibyte/mbtowc.c
+++ b/
src/multibyte/mbtowc.c
@@
-4,6
+4,7
@@
* unnecessary.
*/
* unnecessary.
*/
+#include <stdlib.h>
#include <wchar.h>
#include <errno.h>
#include "internal.h"
#include <wchar.h>
#include <errno.h>
#include "internal.h"
@@
-12,12
+13,14
@@
int mbtowc(wchar_t *restrict wc, const char *restrict src, size_t n)
{
unsigned c;
const unsigned char *s = (const void *)src;
{
unsigned c;
const unsigned char *s = (const void *)src;
+ wchar_t dummy;
if (!s) return 0;
if (!n) goto ilseq;
if (!s) return 0;
if (!n) goto ilseq;
- if (!wc) wc =
(void *)&wc
;
+ if (!wc) wc =
&dummy
;
if (*s < 0x80) return !!(*wc = *s);
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];
if (*s-SA > SB-SA) goto ilseq;
c = bittab[*s++-SA];