From 7591ae56aeeefc978363f92d208d5e1140090f96 Mon Sep 17 00:00:00 2001 From: "Tim J. Robbins" Date: Fri, 20 Sep 2002 13:25:40 +0000 Subject: Lock the file once per call and use the unlocked fgetwc()/fputwc() variants. --- lib/libc/stdio/fputws.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/libc/stdio/fputws.c') diff --git a/lib/libc/stdio/fputws.c b/lib/libc/stdio/fputws.c index 254b4f9de191..467f0982745b 100644 --- a/lib/libc/stdio/fputws.c +++ b/lib/libc/stdio/fputws.c @@ -39,12 +39,15 @@ int fputws(const wchar_t * __restrict ws, FILE * __restrict fp) { - ORIENTLOCK(fp, 1); - + FLOCKFILE(fp); + ORIENT(fp, 1); /* XXX Inefficient */ while (*ws != '\0') - if (fputwc(*ws++, fp) == WEOF) + if (__fputwc(*ws++, fp) == WEOF) { + FUNLOCKFILE(fp); return (-1); + } + FUNLOCKFILE(fp); return (0); } -- cgit v1.3