]> git.ipfire.org Git - thirdparty/systemd.git/commit
string-util: add a mechanism for strextend_with_separator() for specifying "ignore... 36011/head
authorLennart Poettering <lennart@poettering.net>
Wed, 15 Jan 2025 08:32:44 +0000 (09:32 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 15 Jan 2025 09:52:38 +0000 (10:52 +0100)
commitfd3b7cf77239be58680dfd5a98c73d3d6355b303
treebfb96500d91bcbe154f41cc4ebe350477cad426d
parent34467ffa3c1861021293fcfadb6ebc24775b6fda
string-util: add a mechanism for strextend_with_separator() for specifying "ignore" arguments

in strv_new() we have STRV_IGNORE for skipping over an argument in the
argument list. Let's add the same to strextend_with_separator():

strextend_with_separator(&x, "foo", POINTER_MAX, "bar");

will result in "foobar" being appended to "x". (POINTER_MAX Which is
different from NULL, which terminates the argument list).

This is useful for ternary op situations.

(We should probably get rid of STRV_IGNORE and just use POINTER_MAX
everywhere directly, but that's for another time.)
src/basic/string-util.c
src/test/test-string-util.c