fputws.c 995 B

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