From 7f564d2b60e169f7dd0b1d233ec3c41849296026 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 18 Oct 2017 08:32:12 +0200 Subject: [PATCH] MINOR: buffer: add bo_del() to delete a number of characters from output This simply reduces the amount of output data from the buffer after they have been transferred, in a way that is more natural than by fiddling with buf->o. b_del() was renamed to bi_del() to avoid any ambiguity (it's not yet used). --- include/common/buffer.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/common/buffer.h b/include/common/buffer.h index b29946673e..ada43d92fb 100644 --- a/include/common/buffer.h +++ b/include/common/buffer.h @@ -96,12 +96,21 @@ static inline unsigned int b_to_end(const struct buffer *b) * 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) +static inline void bi_del(struct buffer *b, unsigned int del) { b->i -= del; b->p = b_ptr(b, del); } +/* Skips bytes from the output of buffer by simply shrinking . + * The caller is responsible for ensuring that is always smaller than or + * equal to b->o. + */ +static inline void bo_del(struct buffer *b, unsigned int del) +{ + b->o -= 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