]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: buffer: introduce b_make() to make a buffer from its parameters
authorWilly Tarreau <w@1wt.eu>
Fri, 24 May 2019 12:52:56 +0000 (14:52 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 26 May 2019 07:26:59 +0000 (09:26 +0200)
This is convenient to assign a buffer from parts of another one.

include/common/buf.h

index 65770aae5cc09e4f7a1499ad7946575d436d516f..f9a6f72ff02e0f6e44ca4223dac49a581e18cb38 100644 (file)
@@ -399,6 +399,18 @@ static inline void b_reset(struct buffer *b)
        b->data = 0;
 }
 
+/* b_make() : make a buffer from all parameters */
+static inline struct buffer b_make(char *area, size_t size, size_t head, size_t data)
+{
+       struct buffer b;
+
+       b.area = area;
+       b.size = size;
+       b.head = head;
+       b.data = data;
+       return b;
+}
+
 /* b_sub() : decreases the buffer length by <count> */
 static inline void b_sub(struct buffer *b, size_t count)
 {