_wcommit.c 717 B

12345678910111213141516171819202122232425262728293031
  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 __STDIO_BUFFERS
  9. /* Commit the data in the write buffer.
  10. * Returns 0 on success, >0 (pending) on failure.
  11. * Side effects are those of _stdio_WRITE
  12. */
  13. size_t __stdio_wcommit(register FILE * __restrict stream)
  14. {
  15. size_t bufsize;
  16. __STDIO_STREAM_VALIDATE(stream);
  17. if ((bufsize = __STDIO_STREAM_BUFFER_WUSED(stream)) != 0) {
  18. stream->__bufpos = stream->__bufstart;
  19. __stdio_WRITE(stream, stream->__bufstart, bufsize);
  20. }
  21. return __STDIO_STREAM_BUFFER_WUSED(stream);
  22. }
  23. #endif