Avoid fall-through if file matching temporary name exists
[uclibc-ng.git] / libc / stdio / __fpurge.c
blobc17ecf4c0c7c17702ad969b52383b627eb95b319
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"
9 #include <stdio_ext.h>
11 /* Solaris function --
12 * Discard all buffered data whether reading or writing.
15 void __fpurge(register FILE * __restrict stream)
17 __STDIO_STREAM_VALIDATE(stream);
19 __STDIO_STREAM_DISABLE_GETC(stream);
20 __STDIO_STREAM_DISABLE_PUTC(stream);
21 __STDIO_STREAM_INIT_BUFREAD_BUFPOS(stream);
22 stream->__ungot[1] = 0;
24 #ifdef __STDIO_MBSTATE
25 __INIT_MBSTATE(&(stream->__state));
26 #endif
27 #ifdef __UCLIBC_HAS_WCHAR__
28 stream->__ungot_width[0] = 0;
29 #endif
31 stream->__modeflags &= ~(__MASK_READING|__FLAG_WRITING);
33 __STDIO_STREAM_VALIDATE(stream);