]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: buffer: remove bi_ptr()
authorWilly Tarreau <w@1wt.eu>
Thu, 7 Jun 2018 16:08:04 +0000 (18:08 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 19 Jul 2018 14:23:40 +0000 (16:23 +0200)
It's now been replaced by b_head() when b->o is null, ci_head() when
the channel is known, or b_peek(b, b->o) in other situations.

include/common/buffer.h
src/cache.c
src/flt_http_comp.c
src/mux_h2.c

index da65e89c57b32f87eefe39362c0496d5c39dff98..baa8631ffd562cc058fbec802aac001183cda426 100644 (file)
@@ -105,12 +105,6 @@ static inline void bo_del(struct buffer *b, unsigned int del)
        b->o -= del;
 }
 
-/* Returns the start of the input data in a buffer */
-static inline char *bi_ptr(const struct buffer *b)
-{
-       return b->p;
-}
-
 /* Returns the end of the input data in a buffer (pointer to next
  * insertion point).
  */
index c1e6bcc85a768f9561d169e57cdfcf4590a8484e..1265df325b6120a87a3709b7f6d1a40caf5cee58 100644 (file)
@@ -224,7 +224,7 @@ cache_store_http_forward_data(struct stream *s, struct filter *filter,
                                c_adv(msg->chn, st->hdrs_len);
                                ret = shctx_row_data_append(shctx,
                                                            st->first_block,
-                                                           (unsigned char *)bi_ptr(msg->chn->buf),
+                                                           (unsigned char *)ci_head(msg->chn),
                                                            MIN(ci_contig_data(msg->chn), len - st->hdrs_len));
                                /* Rewind the buffer to forward all data */
                                c_rew(msg->chn, st->hdrs_len);
index f26b28b6794c24c060b3b1137de6bba35fa453e0..20843973825760cd982899f0be6d230ef0619332 100644 (file)
@@ -207,7 +207,7 @@ comp_http_data(struct stream *s, struct filter *filter, struct http_msg *msg)
 
                c_adv(chn, *nxt);
                block = ci_contig_data(chn);
-               memcpy(bi_end(tmpbuf), bi_ptr(buf), block);
+               memcpy(bi_end(tmpbuf), ci_head(chn), block);
                if (len > block)
                        memcpy(bi_end(tmpbuf)+block, buf->data, len-block);
                c_rew(chn, *nxt);
@@ -649,7 +649,7 @@ http_compression_buffer_add_data(struct comp_state *st, struct buffer *in,
        block2 = data_process_len - block1;
 
        /* compressors return < 0 upon error or the amount of bytes read */
-       consumed_data = st->comp_algo->add_data(st->comp_ctx, bi_ptr(in), block1, out);
+       consumed_data = st->comp_algo->add_data(st->comp_ctx, b_peek(in, in->o), block1, out);
        if (consumed_data != block1 || !block2)
                goto end;
        consumed_data = st->comp_algo->add_data(st->comp_ctx, in->data, block2, out);
@@ -766,7 +766,7 @@ http_compression_buffer_end(struct comp_state *st, struct stream *s,
        c_adv(chn, st->consumed);
        if (ib->i > 0) {
                left = ci_contig_data(chn);
-               memcpy(ob->p + ob->i, bi_ptr(ib), left);
+               memcpy(ob->p + ob->i, ci_head(chn), left);
                ob->i += left;
                if (ib->i - left) {
                        memcpy(ob->p + ob->i, ib->data, ib->i - left);
index 2f41c6fe88c5850e3a75b59d1d24a621cee00712..b7b98aad6db04d7f500f3b77b91cd5cb75ad9867 100644 (file)
@@ -2780,7 +2780,7 @@ static int h2_frt_transfer_data(struct h2s *h2s, struct buffer *buf, int count)
                if (h2c->dbuf->i < 1)
                        return 0;
 
-               h2c->dpl = *(uint8_t *)bi_ptr(h2c->dbuf);
+               h2c->dpl = *(uint8_t *)b_head(h2c->dbuf);
                if (h2c->dpl >= h2c->dfl) {
                        /* RFC7540#6.1 : pad length = length of frame payload or greater */
                        h2c_error(h2c, H2_ERR_PROTOCOL_ERROR);