| 3052 | } |
| 3053 | |
| 3054 | static int stdio_stream_buf_init(FILE *stream) |
| 3055 | { |
| 3056 | if (stream->flags & STDIO_FLAG_NO_BUF) |
| 3057 | { |
| 3058 | stream->buf = NULL; |
| 3059 | stream->bufsiz = 0; |
| 3060 | } |
| 3061 | else if (stream->buf == NULL) |
| 3062 | { |
| 3063 | stream->buf = (char *)malloc(stream->bufsiz); |
| 3064 | if (stream->buf == NULL) |
| 3065 | return EOF; |
| 3066 | stream->flags |= STDIO_FLAG_OWN_BUF; |
| 3067 | } |
| 3068 | stream->flags |= STDIO_FLAG_INITED; |
| 3069 | return 0; |
| 3070 | } |
| 3071 | |
| 3072 | static ssize_t stdio_stream_read_buf(FILE *stream, char *start, char *end) |
| 3073 | { |
no test coverage detected