1 #include "stdio_impl.h"
3 /* The behavior of this function is undefined except when it is the first
4 * operation on the stream, so the presence or absence of locking is not
5 * observable in a program whose behavior is defined. Thus no locking is
6 * performed here. No allocation of buffers is performed, but a buffer
7 * provided by the caller is used as long as it is suitably sized. */
9 int setvbuf(FILE *restrict f
, char *restrict buf
, int type
, size_t size
)
15 } else if (type
== _IOLBF
|| type
== _IOFBF
) {
16 if (buf
&& size
>= UNGET
) {
17 f
->buf
= (void *)(buf
+ UNGET
);
18 f
->buf_size
= size
- UNGET
;
20 if (type
== _IOLBF
&& f
->buf_size
)