fputws.c 1.1 KB

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