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 from __uflow */
30 if (!mbsinit(&st)) errno = EILSEQ;
33 l = mbrtowc(&wc, (void *)&b, 1, &st);
34 if (l == -1) return WEOF;
41 wint_t fgetwc(FILE *f)
45 c = __fgetwc_unlocked(f);
50 weak_alias(__fgetwc_unlocked, fgetwc_unlocked);
51 weak_alias(__fgetwc_unlocked, getwc_unlocked);