MCPcopy Create free account
hub / github.com/ElementsProject/lightning / get_more

Function get_more

ccan/ccan/rbuf/rbuf.c:30–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30static ssize_t get_more(struct rbuf *rbuf)
31{
32 ssize_t r;
33
34 /* This is so we only call rbuf_good_size once. */
35 if (tcon_unwrap(&rbuf->m)->max_elems == 0)
36 membuf_prepare_space(&rbuf->m, rbuf_good_size(rbuf->fd));
37 else /* membuf doubles internally, so just ask for anything. */
38 membuf_prepare_space(&rbuf->m, 1);
39
40 /* This happens if realloc fails (errno already ENOMEM) */
41 if (!membuf_num_space(&rbuf->m))
42 return -1;
43
44 r = read(rbuf->fd, membuf_space(&rbuf->m), membuf_num_space(&rbuf->m));
45 if (r <= 0)
46 return r;
47
48 membuf_add(&rbuf->m, r);
49 return r;
50}
51
52void *rbuf_fill_all(struct rbuf *rbuf)
53{

Callers 3

rbuf_fill_allFunction · 0.85
rbuf_fillFunction · 0.85
rbuf_read_strFunction · 0.85

Calls 1

rbuf_good_sizeFunction · 0.85

Tested by

no test coverage detected