]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: ncbuf: complete API and define block interal abstraction
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 9 May 2022 07:38:45 +0000 (09:38 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 12 May 2022 16:18:47 +0000 (18:18 +0200)
commitd5d2ed90f030bc15c834852f5bc42f827f636741
tree04f177d9bdb2582bc3ca702d9af500fc2ea8362d
parent1b5f77fc181b5c59351f5f6e474317505e4c5a8f
MINOR: ncbuf: complete API and define block interal abstraction

Implement two new functions to report the total data stored accross the
whole buffer and the data stored at a specific offset until the next gap
or the buffer end.

To facilitate implementation of these new functions and also future
add/delete operations, a new abstraction is introduced : ncb_blk. This
structure represents a block of either data or gap in the buffer. It
simplifies operation when moving forward in the buffer. The first buffer
block can be retrieved via ncb_blk_first(buf). The block at a specific
offset is accessed via ncb_blk_find(buf, off).

This abstraction is purely used in functions but not stored in the ncbuf
structure per-se. This is necessary to keep the minimal memory
footprint.
include/haproxy/ncbuf-t.h
include/haproxy/ncbuf.h
src/ncbuf.c