]> git.ipfire.org Git - thirdparty/kmod.git/commit
strbuf: Add strbuf_reserve_extra()
authorLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 12 Nov 2024 18:07:39 +0000 (12:07 -0600)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Sun, 17 Nov 2024 21:35:13 +0000 (15:35 -0600)
commit952bf223e050fdd576eb573dd099875fbb3518c2
tree5b1e00eb5736364ecac2326838c8246994eb3499
parent1e36bfada5bafd3f7d4f32191724a69c57c07e7f
strbuf: Add strbuf_reserve_extra()

To accomplish the same task as scratchbuf_alloc() does: make sure the
buffer has enough space for next operations. One difference is that
ensures **extra** space, not the total space. If needed in future,
a strbuf_reserve(), that resembles C++'s std::vector::reserve(), can be
added on top.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/239
shared/strbuf.c
shared/strbuf.h
testsuite/test-strbuf.c