MCPcopy Create free account
hub / github.com/GJDuck/e9patch / stdio_stream_read_init

Function stdio_stream_read_init

examples/stdlib.c:3182–3201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3180}
3181
3182static int stdio_stream_read_init(FILE *stream)
3183{
3184 if (!(stream->flags & STDIO_FLAG_READ) ||
3185 (stream->flags & STDIO_FLAG_ERROR) ||
3186 (stream->flags & STDIO_FLAG_EOF))
3187 {
3188 errno = EINVAL;
3189 return EOF;
3190 }
3191 if (stream->flags & STDIO_FLAG_WRITING)
3192 fflush_unlocked(stream);
3193 stream->flags |= STDIO_FLAG_READING;
3194 if (!(stream->flags & STDIO_FLAG_INITED) &&
3195 stdio_stream_buf_init(stream) < 0)
3196 return EOF;
3197 if (stream->read_ptr >= stream->read_end &&
3198 stdio_stream_read(stream) < 0)
3199 return EOF;
3200 return 0;
3201}
3202
3203static int stdio_stream_write_init(FILE *stream)
3204{

Callers 4

fgetc_unlockedFunction · 0.85
fgets_unlockedFunction · 0.85
ungetc_unlockedFunction · 0.85
fread_unlockedFunction · 0.85

Calls 3

fflush_unlockedFunction · 0.85
stdio_stream_buf_initFunction · 0.85
stdio_stream_readFunction · 0.85

Tested by

no test coverage detected