1 #include "stdio_impl.h"
3 wint_t __fgetwc_unlocked(FILE *f)
13 /* Convert character from buffer if possible */
14 if (f->rpos < f->rend) {
15 l = mbrtowc(&wc, (void *)f->rpos, f->rend - f->rpos, &st);
17 f->rpos += l + !l; /* l==0 means 1 byte, null */
26 /* Convert character byte-by-byte */
28 b = c = getc_unlocked(f);
30 if (!mbsinit(&st)) errno = EILSEQ;
33 l = mbrtowc(&wc, (void *)&b, 1, &st);
34 if (l == -1) return WEOF;
40 wint_t fgetwc(FILE *f)
44 c = __fgetwc_unlocked(f);
49 weak_alias(__fgetwc_unlocked, fgetwc_unlocked);
50 weak_alias(__fgetwc_unlocked, getwc_unlocked);