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).
This commit is contained in:
Willy Tarreau 2017-10-18 08:32:12 +02:00
parent 253e53e661
commit 7f564d2b60
1 changed files with 10 additions and 1 deletions

View File

@ -96,12 +96,21 @@ static inline unsigned int b_to_end(const struct buffer *b)
* The caller is responsible for ensuring that <del> 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 <del> bytes from the output of buffer <b> by simply shrinking <o>.
* The caller is responsible for ensuring that <del> 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 <adv> 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