| 25 | } |
| 26 | |
| 27 | char *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 | |
| 50 | size_t hc_putc(struct hc_stream *s, const char data) { |
| 51 | const uint8_t d[2] = {data, 0}; |
nothing calls this directly
no test coverage detected