| lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 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 |  | 
|  | 12 | #ifdef __DO_UNLOCKED | 
|  | 13 |  | 
|  | 14 | int fputws_unlocked(const wchar_t *__restrict ws, | 
|  | 15 | register FILE *__restrict stream) | 
|  | 16 | { | 
|  | 17 | size_t n = wcslen(ws); | 
|  | 18 |  | 
|  | 19 | return (_wstdio_fwrite(ws, n, stream) == n) ? 0 : -1; | 
|  | 20 | } | 
|  | 21 | libc_hidden_def(fputws_unlocked) | 
|  | 22 |  | 
|  | 23 | #ifndef __UCLIBC_HAS_THREADS__ | 
|  | 24 | strong_alias(fputws_unlocked,fputws) | 
|  | 25 | libc_hidden_def(fputws) | 
|  | 26 | #endif | 
|  | 27 |  | 
|  | 28 | #elif defined __UCLIBC_HAS_THREADS__ | 
|  | 29 |  | 
|  | 30 | int fputws(const wchar_t *__restrict ws, register FILE *__restrict stream) | 
|  | 31 | { | 
|  | 32 | int retval; | 
|  | 33 | __STDIO_AUTO_THREADLOCK_VAR; | 
|  | 34 |  | 
|  | 35 | __STDIO_AUTO_THREADLOCK(stream); | 
|  | 36 |  | 
|  | 37 | retval = fputws_unlocked(ws, stream); | 
|  | 38 |  | 
|  | 39 | __STDIO_AUTO_THREADUNLOCK(stream); | 
|  | 40 |  | 
|  | 41 | return retval; | 
|  | 42 | } | 
|  | 43 | libc_hidden_def(fputws) | 
|  | 44 |  | 
|  | 45 | #endif |