fputwc.c 868 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. weak_alias(__fputwc_unlocked,fputwc_unlocked);
  10. weak_alias(__fputwc_unlocked,putwc_unlocked);
  11. #ifndef __UCLIBC_HAS_THREADS__
  12. weak_alias(__fputwc_unlocked,fputwc);
  13. weak_alias(__fputwc_unlocked,putwc);
  14. #endif
  15. wint_t __fputwc_unlocked(wchar_t wc, FILE *stream)
  16. {
  17. return _wstdio_fwrite(&wc, 1, stream) ? wc : WEOF;
  18. }
  19. #elif defined __UCLIBC_HAS_THREADS__
  20. weak_alias(fputwc,putwc);
  21. wint_t fputwc(wchar_t wc, register FILE *stream)
  22. {
  23. wint_t retval;
  24. __STDIO_AUTO_THREADLOCK_VAR;
  25. __STDIO_AUTO_THREADLOCK(stream);
  26. retval = __fputwc_unlocked(wc, stream);
  27. __STDIO_AUTO_THREADUNLOCK(stream);
  28. return retval;
  29. }
  30. #endif