blob: a0b3219b11e1cedd0f5228e5abbc1ef0eea76edf [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/* 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
8#include "_stdio.h"
9
10#ifdef __STDIO_BUFFERS
11
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
15 */
16
17size_t attribute_hidden __stdio_wcommit(register FILE * __restrict stream)
18{
19 size_t bufsize;
20
21 __STDIO_STREAM_VALIDATE(stream);
22
23 if ((bufsize = __STDIO_STREAM_BUFFER_WUSED(stream)) != 0) {
24 stream->__bufpos = stream->__bufstart;
25 __stdio_WRITE(stream, stream->__bufstart, bufsize);
26 }
27
28 return __STDIO_STREAM_BUFFER_WUSED(stream);
29}
30
31#endif