MCPcopy Create free account
hub / github.com/codr7/hacktical-c / hc_gets

Function hc_gets

stream1/stream1.c:27–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27char *hc_gets(struct hc_stream *s, struct hc_malloc *malloc) {
28 struct hc_vector out;
29 hc_vector_init(&out, malloc, 1);
30
31 for (;;) {
32 char c = hc_getc(s);
33
34 if (c == EOF) {
35 break;
36 }
37
38 *(char *)hc_vector_push(&out) = c;
39
40 if (c == '\n') {
41 break;
42 }
43 }
44
45
46 *(char *)hc_vector_push(&out) = 0;
47 return (char *)out.start;
48}
49
50size_t hc_putc(struct hc_stream *s, const char data) {
51 const uint8_t d[2] = {data, 0};

Callers

nothing calls this directly

Calls 3

hc_vector_initFunction · 0.85
hc_getcFunction · 0.85
hc_vector_pushFunction · 0.85

Tested by

no test coverage detected