diff options
author | Jakob Kaivo <jkk@ung.org> | 2020-08-15 15:24:14 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2020-08-15 15:24:14 -0400 |
commit | 629cab425f0439866694dfbf44650b6dc6623ea5 (patch) | |
tree | bc75d04cc40b861fa8a51cd5faa3a3af6f53556f | |
parent | fa929d5cd61d0ba5fb4bfdbb9af8a979493b6697 (diff) |
cleanup
-rw-r--r-- | src/wchar/fputwc.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/wchar/fputwc.c b/src/wchar/fputwc.c index 803ccfdb..056ff472 100644 --- a/src/wchar/fputwc.c +++ b/src/wchar/fputwc.c @@ -1,25 +1,23 @@ #include <wchar.h> -#include "stdio.h" -#include "../stdio/_stdio.h" -#include "limits.h" -#include "errno.h" +#include <stdio.h> +#include <limits.h> +#include <errno.h> +#include "stdio/_stdio.h" wint_t fputwc(wchar_t c, FILE * stream) { + char mbs[MB_LEN_MAX+1] = {0}; + mbstate_t ps = 0; + size_t len = wcrtomb(mbs, c, &ps); size_t i; if (fwide(stream, 1) <= 0) { - /* not a wide stream */ return WEOF; } flockfile(stream); stream->orientation = -1; - char mbs[MB_LEN_MAX+1] = {0}; - mbstate_t ps = 0; - size_t len = wcrtomb(mbs, c, &ps); - if (len == (size_t)-1) { errno = EILSEQ; return WEOF; @@ -27,7 +25,7 @@ wint_t fputwc(wchar_t c, FILE * stream) /* FIXME: check for errors here */ for (i = 0; i < len; i++) { - fputc(mbs[i], stream); + putc_unlocked(mbs[i], stream); } stream->orientation = 1; |