fputws.c 999 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #define wcslen __wcslen
  8. #include "_stdio.h"
  9. extern int __fputws_unlocked(const wchar_t *__restrict ws,
  10. FILE *__restrict stream) attribute_hidden;
  11. #ifdef __DO_UNLOCKED
  12. int attribute_hidden __fputws_unlocked(const wchar_t *__restrict ws,
  13. register FILE *__restrict stream)
  14. {
  15. size_t n = wcslen(ws);
  16. return (_wstdio_fwrite(ws, n, stream) == n) ? 0 : -1;
  17. }
  18. weak_alias(__fputws_unlocked,fputws_unlocked)
  19. #ifndef __UCLIBC_HAS_THREADS__
  20. weak_alias(__fputws_unlocked,fputws)
  21. #endif
  22. #elif defined __UCLIBC_HAS_THREADS__
  23. int fputws(const wchar_t *__restrict ws, register FILE *__restrict stream)
  24. {
  25. int retval;
  26. __STDIO_AUTO_THREADLOCK_VAR;
  27. __STDIO_AUTO_THREADLOCK(stream);
  28. retval = __fputws_unlocked(ws, stream);
  29. __STDIO_AUTO_THREADUNLOCK(stream);
  30. return retval;
  31. }
  32. #endif