fputws.c 882 B

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