aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/stdio/fputwc.c
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2023-11-20 20:46:14 +0100
committerCorinna Vinschen <corinna@vinschen.de>2023-11-20 20:59:13 +0100
commit09119463a1445be498f8a6ce3834d462361c7dd3 (patch)
treead5e3e893c9ec6b07b032ee9c3768ba509e402c9 /newlib/libc/stdio/fputwc.c
parentbc986b7ff668aa98372fc4e885307339e7ab3f51 (diff)
downloadnewlib-09119463a1445be498f8a6ce3834d462361c7dd3.zip
newlib-09119463a1445be498f8a6ce3834d462361c7dd3.tar.gz
newlib-09119463a1445be498f8a6ce3834d462361c7dd3.tar.bz2
stdio: split byte- and wide-char-oriented low-level output functions
Introduce function __swbufw_r and macros/inline-functions called __swputc_r. Call these functions/macros exclusively from wide-char functions. This allows to set and test the stream orientation correctly even if output is only performed using byte-oriented macros from stdio.h. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc/stdio/fputwc.c')
-rw-r--r--newlib/libc/stdio/fputwc.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/newlib/libc/stdio/fputwc.c b/newlib/libc/stdio/fputwc.c
index ef2be10..8430446 100644
--- a/newlib/libc/stdio/fputwc.c
+++ b/newlib/libc/stdio/fputwc.c
@@ -155,7 +155,7 @@ __fputwc (struct _reent *ptr,
}
for (i = 0; i < len; i++)
- if (__sputc_r (ptr, (unsigned char) buf[i], fp) == EOF)
+ if (__swputc_r (ptr, (unsigned char) buf[i], fp) == EOF)
return WEOF;
return (wint_t) wc;
@@ -169,10 +169,7 @@ _fputwc_r (struct _reent *ptr,
wint_t r;
_newlib_flockfile_start (fp);
- if (ORIENT(fp, 1) != 1)
- r = WEOF;
- else
- r = __fputwc(ptr, wc, fp);
+ __fputwc(ptr, wc, fp);
_newlib_flockfile_end (fp);
return r;
}