1 /* Copyright (C) 2004       Manuel Novoa III    <mjn3@codepoet.org>
2  *
3  * GNU Library General Public License (LGPL) version 2 or later.
4  *
5  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
6  */
7 
8 #include "_stdio.h"
9 
10 
11 #ifdef __DO_UNLOCKED
12 
fputwc_unlocked(wchar_t wc,FILE * stream)13 wint_t fputwc_unlocked(wchar_t wc, FILE *stream)
14 {
15 	return _wstdio_fwrite(&wc, 1, stream) ? wc : WEOF;
16 }
17 libc_hidden_def(fputwc_unlocked)
18 
19 strong_alias(fputwc_unlocked,putwc_unlocked)
20 #ifndef __UCLIBC_HAS_THREADS__
21 strong_alias(fputwc_unlocked,fputwc)
22 libc_hidden_def(fputwc)
23 strong_alias(fputwc_unlocked,putwc)
24 #endif
25 
26 #elif defined __UCLIBC_HAS_THREADS__
27 
28 wint_t fputwc(wchar_t wc, register FILE *stream)
29 {
30 	wint_t retval;
31 	__STDIO_AUTO_THREADLOCK_VAR;
32 
33 	__STDIO_AUTO_THREADLOCK(stream);
34 
35 	retval = fputwc_unlocked(wc, stream);
36 
37 	__STDIO_AUTO_THREADUNLOCK(stream);
38 
39 	return retval;
40 }
41 libc_hidden_def(fputwc)
42 
43 strong_alias(fputwc,putwc)
44 
45 #endif
46