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

Function fputs_unlocked

examples/stdlib.c:3484–3511  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3482}
3483
3484static int fputs_unlocked(const char *s, FILE *stream)
3485{
3486 if (stdio_stream_write_init(stream) < 0)
3487 return EOF;
3488 if (stream->write_ptr == NULL)
3489 {
3490 size_t len = strlen(s);
3491 if (stdio_stream_write_buf(stream, s, s + len) < 0)
3492 return EOF;
3493 return 0;
3494 }
3495 bool flush = false;
3496 for (; *s != 0; s++)
3497 {
3498 *stream->write_ptr++ = *s;
3499 if (stream->write_ptr >= stream->write_end)
3500 {
3501 if (stdio_stream_write(stream) < 0)
3502 return EOF;
3503 flush = false;
3504 }
3505 else if ((int)(unsigned char)*s == stream->eol)
3506 flush = true;
3507 }
3508 if (flush && stdio_stream_write(stream) < 0)
3509 return EOF;
3510 return 0;
3511}
3512
3513static int fputs(const char *s, FILE *stream)
3514{

Callers 4

entryFunction · 0.85
fputsFunction · 0.85
puts_unlockedFunction · 0.85
vfprintf_unlockedFunction · 0.85

Calls 4

stdio_stream_write_initFunction · 0.85
stdio_stream_write_bufFunction · 0.85
stdio_stream_writeFunction · 0.85
strlenFunction · 0.70

Tested by

no test coverage detected