Lines Matching refs:buf
28 void nghttp3_buf_init(nghttp3_buf *buf) {
29 buf->begin = buf->end = buf->pos = buf->last = NULL;
32 void nghttp3_buf_wrap_init(nghttp3_buf *buf, uint8_t *src, size_t len) {
33 buf->begin = buf->pos = buf->last = src;
34 buf->end = buf->begin + len;
37 void nghttp3_buf_free(nghttp3_buf *buf, const nghttp3_mem *mem) {
38 nghttp3_mem_free(mem, buf->begin);
41 size_t nghttp3_buf_left(const nghttp3_buf *buf) {
42 return (size_t)(buf->end - buf->last);
45 size_t nghttp3_buf_len(const nghttp3_buf *buf) {
46 return (size_t)(buf->last - buf->pos);
49 size_t nghttp3_buf_cap(const nghttp3_buf *buf) {
50 return (size_t)(buf->end - buf->begin);
53 void nghttp3_buf_reset(nghttp3_buf *buf) { buf->pos = buf->last = buf->begin; }
55 int nghttp3_buf_reserve(nghttp3_buf *buf, size_t size, const nghttp3_mem *mem) {
59 if ((size_t)(buf->end - buf->begin) >= size) {
63 pos_offset = buf->pos - buf->begin;
64 last_offset = buf->last - buf->begin;
66 p = nghttp3_mem_realloc(mem, buf->begin, size);
71 buf->begin = p;
72 buf->end = p + size;
73 buf->pos = p + pos_offset;
74 buf->last = p + last_offset;
86 void nghttp3_typed_buf_init(nghttp3_typed_buf *tbuf, const nghttp3_buf *buf,
88 tbuf->buf = *buf;