libc: fix MIPS N64 fork
[uclibc-ng.git] / libc / stdio / _wcommit.c
bloba0b3219b11e1cedd0f5228e5abbc1ef0eea76edf
1 /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
3 * GNU Library General Public License (LGPL) version 2 or later.
5 * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
6 */
8 #include "_stdio.h"
10 #ifdef __STDIO_BUFFERS
12 /* Commit the data in the write buffer.
13 * Returns 0 on success, >0 (pending) on failure.
14 * Side effects are those of _stdio_WRITE
17 size_t attribute_hidden __stdio_wcommit(register FILE * __restrict stream)
19 size_t bufsize;
21 __STDIO_STREAM_VALIDATE(stream);
23 if ((bufsize = __STDIO_STREAM_BUFFER_WUSED(stream)) != 0) {
24 stream->__bufpos = stream->__bufstart;
25 __stdio_WRITE(stream, stream->__bufstart, bufsize);
28 return __STDIO_STREAM_BUFFER_WUSED(stream);
31 #endif