Lines Matching refs:bp
16 ct_buf_init(ct_buf_t *bp, void *mem, size_t len)
18 memset(bp, 0, sizeof(*bp));
19 bp->base = (unsigned char *) mem;
20 bp->size = len;
24 ct_buf_set(ct_buf_t *bp, void *mem, size_t len)
26 ct_buf_init(bp, mem, len);
27 bp->tail = len;
31 ct_buf_get(ct_buf_t *bp, void *mem, size_t len)
33 if (len > bp->tail - bp->head)
36 memcpy(mem, bp->base + bp->head, len);
37 bp->head += len;
42 ct_buf_put(ct_buf_t *bp, const void *mem, size_t len)
44 if (len > bp->size - bp->tail) {
45 bp->overrun = 1;
49 memcpy(bp->base + bp->tail, mem, len);
50 bp->tail += len;
55 ct_buf_putc(ct_buf_t *bp, int byte)
59 return ct_buf_put(bp, &c, 1);
63 ct_buf_avail(ct_buf_t *bp)
65 return bp->tail - bp->head;
69 ct_buf_head(ct_buf_t *bp)
71 return bp->base + bp->head;