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:
parent
253e53e661
commit
7f564d2b60
|
@ -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
|
* The caller is responsible for ensuring that <del> is always smaller than or
|
||||||
* equal to b->i.
|
* 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->i -= del;
|
||||||
b->p = b_ptr(b, 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
|
/* Advances the buffer by <adv> bytes, which means that the buffer
|
||||||
* pointer advances, and that as many bytes from in are transferred
|
* pointer advances, and that as many bytes from in are transferred
|
||||||
* to out. The caller is responsible for ensuring that adv is always
|
* to out. The caller is responsible for ensuring that adv is always
|
||||||
|
|
Loading…
Reference in New Issue