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

Function stdio_stream_write_init

examples/stdlib.c:3203–3221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3201}
3202
3203static int stdio_stream_write_init(FILE *stream)
3204{
3205 if (!(stream->flags & STDIO_FLAG_WRITE) ||
3206 (stream->flags & STDIO_FLAG_ERROR))
3207 {
3208 errno = EINVAL;
3209 return EOF;
3210 }
3211 if (stream->flags & STDIO_FLAG_READING)
3212 fflush_unlocked(stream);
3213 stream->flags |= STDIO_FLAG_WRITING;
3214 if (!(stream->flags & STDIO_FLAG_INITED) &&
3215 stdio_stream_buf_init(stream) < 0)
3216 return EOF;
3217 if (stream->write_ptr >= stream->write_end &&
3218 stdio_stream_write(stream) < 0)
3219 return EOF;
3220 return 0;
3221}
3222
3223static void stdio_stream_free(FILE *stream)
3224{

Callers 3

fputc_unlockedFunction · 0.85
fputs_unlockedFunction · 0.85
fwrite_unlockedFunction · 0.85

Calls 3

fflush_unlockedFunction · 0.85
stdio_stream_buf_initFunction · 0.85
stdio_stream_writeFunction · 0.85

Tested by

no test coverage detected