]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: buffer: add bo_del() to delete a number of characters from output
authorWilly Tarreau <w@1wt.eu>
Wed, 18 Oct 2017 06:32:12 +0000 (08:32 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 19 Oct 2017 13:01:07 +0000 (15:01 +0200)
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

index b29946673ef4a5a935827453679387c4353b1a9a..ada43d92fb1bfeedfe96844fee79376ad0799a7a 100644 (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