blob: aa7c480342683cc07b46ca592246cbca2cd76b48 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include <wchar.h>
#include "_wchar.h"
GCC_SSE_HACK
size_t mbrtowc(wchar_t * restrict pwc, const char * restrict s, size_t n, mbstate_t * restrict ps)
{
static struct __mbstate_t internal = { 0 };
static mbstate_t ip = { &internal };
if (ps == NULL) {
ps = &ip;
}
SIGNAL_SAFE(0);
ASSERT_MBSTATE(ps, MBTOW, s, pwc);
/* TODO: overlap */
if (s == NULL) {
return mbrtowc(NULL, "", 1, ps);
}
SET_MBSTATE(ps, MBTOW, s, pwc);
return n;
}
/*
STDC(199409)
*/
|