MINOR: buf: add b_putblk_ofs() to copy a block at a specific position
authorWilly Tarreau <w@1wt.eu>
Thu, 23 Feb 2023 11:02:05 +0000 (12:02 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 Mar 2024 17:34:19 +0000 (17:34 +0000)
commit2f28981546c6f57157d26b46e64d442f97742a31
tree80d2538c3600821be7fd455b8b766f22e969c887
parentc5004ccb3680847cf0fc42a2fd7afc9df32c64d5
MINOR: buf: add b_putblk_ofs() to copy a block at a specific position

This new function b_putblk_ofs() puts one full block of data of length
<len> from <blk> into the buffer, starting from absolute offset <offset>
after the buffer's area.  As a convenience to avoid complex checks in
callers, the offset is allowed to exceed a valid one by no more than one
buffer size, and will automatically be wrapped. The caller is responsible
for ensuring that <len> doesn't exceed the known length of the available
room at this position, otherwise data may be overwritten. The buffer's
length is *not* updated, so generally the caller will have updated it
before calling this function. This is meant to be used on concurrently
accessed buffers, so that a writer can append data while a reader is
blocked by other means from reaching the current area The function
guarantees never to use ->head nor ->data.
include/haproxy/buf.h