From: Willy Tarreau Date: Fri, 24 May 2019 12:52:56 +0000 (+0200) Subject: MINOR: buffer: introduce b_make() to make a buffer from its parameters X-Git-Tag: v2.0-dev5~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e39b58f0450bcbc7df60167d758e2dd31c11025a;p=thirdparty%2Fhaproxy.git MINOR: buffer: introduce b_make() to make a buffer from its parameters This is convenient to assign a buffer from parts of another one. --- diff --git a/include/common/buf.h b/include/common/buf.h index 65770aae5c..f9a6f72ff0 100644 --- a/include/common/buf.h +++ b/include/common/buf.h @@ -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 */ static inline void b_sub(struct buffer *b, size_t count) {