]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: istbuf: add ist2buf() function
authorBaptiste Assmann <bedis9@gmail.com>
Sat, 18 Apr 2020 12:50:11 +0000 (14:50 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 5 May 2020 13:28:59 +0000 (15:28 +0200)
Purpose of this function is to build a <struct buffer> from a <struct
ist>.

include/common/istbuf.h

index 9b6ce7c6bdf4ea9918225fedf56473297c78d843..a533c71749ea9eca49a25464bddf6b4c214a1d8d 100644 (file)
@@ -139,6 +139,19 @@ static inline size_t b_putist(struct buffer *b, const struct ist ist)
        return b_putblk(b, ist.ptr, ist.len);
 }
 
+/* builds and return a <struct buffer> based on <ist>
+ */
+static inline struct buffer ist2buf(const struct ist ist)
+{
+       struct buffer buf;
+
+       buf.area = ist.ptr;
+       buf.size = ist.len;
+       buf.data = ist.len;
+       buf.head = 0;
+       return buf;
+}
+
 #endif /* _COMMON_ISTBUF_H */
 
 /*