summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/fgetwc.c
diff options
context:
space:
mode:
authorTim J. Robbins <tjr@FreeBSD.org>2004-04-07 09:55:05 +0000
committerTim J. Robbins <tjr@FreeBSD.org>2004-04-07 09:55:05 +0000
commit93996f6d58e252f9f975d3bc8522df8fe227f002 (patch)
tree12c84b3433d9dfe7221d8772b9282c58a3f99811 /lib/libc/stdio/fgetwc.c
parente97e8562744f5b6a68d5ee5da07c791c42785e80 (diff)
Notes
Diffstat (limited to 'lib/libc/stdio/fgetwc.c')
-rw-r--r--lib/libc/stdio/fgetwc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/stdio/fgetwc.c b/lib/libc/stdio/fgetwc.c
index 3a6e6e135e04..0b8344135e22 100644
--- a/lib/libc/stdio/fgetwc.c
+++ b/lib/libc/stdio/fgetwc.c
@@ -77,6 +77,8 @@ fgetwc(FILE *fp)
static __inline wint_t
__fgetwc_nbf(FILE *fp)
{
+ static const mbstate_t initial;
+ mbstate_t mbs;
char buf[MB_LEN_MAX];
size_t n, nconv;
int c;
@@ -90,7 +92,8 @@ __fgetwc_nbf(FILE *fp)
break;
}
buf[n++] = (char)c;
- nconv = mbrtowc(&wc, buf, n, NULL);
+ mbs = initial;
+ nconv = mbrtowc(&wc, buf, n, &mbs);
if (nconv == n)
return (wc);
else if (nconv == 0)