| 147 | } |
| 148 | |
| 149 | static struct io_plan *io_read_partial_test(struct io_conn *conn, |
| 150 | void *data, |
| 151 | size_t maxlen, |
| 152 | size_t *lenp, |
| 153 | struct io_plan *(*next)(struct io_conn *, void *), |
| 154 | void *arg) |
| 155 | { |
| 156 | char *out = (char *)data; |
| 157 | size_t n = feed_next_chunk(maxlen); |
| 158 | |
| 159 | FEED.calls_to_io_read++; |
| 160 | if (n) { |
| 161 | memcpy(out, FEED.data + FEED.off, n); |
| 162 | FEED.off += n; |
| 163 | } |
| 164 | *lenp = n; |
| 165 | |
| 166 | /* No more input -> end the chain */ |
| 167 | if (n == 0) |
| 168 | return NULL; |
| 169 | |
| 170 | return next(conn, arg); |
| 171 | } |
| 172 | |
| 173 | /* ---------- minimal “handler” to count parsed messages ---------- */ |
| 174 |
nothing calls this directly
no test coverage detected