1 #include "stdio_impl.h"
5 wint_t __fgetwc_unlocked(FILE *f)
15 /* Convert character from buffer if possible */
16 if (f->rpos < f->rend) {
17 l = mbrtowc(&wc, (void *)f->rpos, f->rend - f->rpos, &st);
19 f->rpos += l + !l; /* l==0 means 1 byte, null */
28 /* Convert character byte-by-byte */
30 b = c = getc_unlocked(f);
32 if (!mbsinit(&st)) errno = EILSEQ;
35 l = mbrtowc(&wc, (void *)&b, 1, &st);
36 if (l == -1) return WEOF;
42 wint_t fgetwc(FILE *f)
46 c = __fgetwc_unlocked(f);
51 weak_alias(__fgetwc_unlocked, fgetwc_unlocked);
52 weak_alias(__fgetwc_unlocked, getwc_unlocked);