From fa929d5cd61d0ba5fb4bfdbb9af8a979493b6697 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Sat, 15 Aug 2020 15:22:42 -0400 Subject: clean up --- src/wchar/fgetwc.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src/wchar') diff --git a/src/wchar/fgetwc.c b/src/wchar/fgetwc.c index 8d725b6e..04cc2781 100644 --- a/src/wchar/fgetwc.c +++ b/src/wchar/fgetwc.c @@ -1,27 +1,22 @@ #include -#include "stdio.h" -#include "../stdio/_stdio.h" -#include "limits.h" - -#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 199506L -#include "../unistd/read.c" -#endif +#include +#include +#include "stdio/_stdio.h" wint_t fgetwc(FILE * stream) { - if (fwide(stream, 1) <= 0) { + char mbr[MB_LEN_MAX+1] = {0}; + mbstate_t ps = 0; + wint_t wc = 0; + int n = 0; + if (fwide(stream, 1) <= 0) { return WEOF; } flockfile(stream); stream->orientation = -1; - char mbr[MB_LEN_MAX+1] = {0}; - int n = 0; - mbstate_t ps = 0; - wint_t wc = 0; - /* FIXME: check for (size_t)-2 and (size_t)-1 from mbrtowc */ do { mbr[n++] = getc_unlocked(stream); -- cgit v1.2.1