From: Willy Tarreau Date: Tue, 19 Sep 2017 12:18:46 +0000 (+0200) Subject: MINOR: buffer: add b_del() to delete a number of characters X-Git-Tag: v1.8-dev3~80 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=4a6425d37374f5f514a67fdb67454b24da64d7ef;p=haproxy-3.0.git MINOR: buffer: add b_del() to delete a number of characters This will be used by code which directly parses buffers with no channel in the middle (eg: h2, might be used by checks as well). --- diff --git a/include/common/buffer.h b/include/common/buffer.h index f1edae0..8043e29 100644 --- a/include/common/buffer.h +++ b/include/common/buffer.h @@ -79,6 +79,17 @@ void buffer_slow_realign(struct buffer *buf); __ret; \ }) +/* Skips bytes in a one-way buffer :

advances by , + * shrinks by as well, and is left untouched (supposed to be zero). + * The caller is responsible for ensuring that is always smaller than or + * equal to b->i. + */ +static inline void b_del(struct buffer *b, unsigned int del) +{ + b->i -= del; + b->p = b_ptr(b, del); +} + /* Advances the buffer by bytes, which means that the buffer * pointer advances, and that as many bytes from in are transferred * to out. The caller is responsible for ensuring that adv is always