basic/strv: add optimizable version of strv_push/consume/extend
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 19 May 2022 07:50:48 +0000 (09:50 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 20 May 2022 13:18:28 +0000 (15:18 +0200)
commit3ec3ae68d2cea32461d779645a737d57160631bf
treede96287e883a1a164e308cebc8bd88ac6b302920
parentbd144c9643aedb045e0df5fc1ada2e467c802b47
basic/strv: add optimizable version of strv_push/consume/extend

This will be helpful in cases where we are repeatedly adding entries
to a long strv and want to skip the iteration over old entries leading
to quadratic behaviour.

Note that we don't want to calculate the length if not necessary, so
the calculation is delayed until after we've checked that value is not
NULL.
src/basic/strv.c
src/basic/strv.h
src/test/test-strv.c