string-util: rework strextend() to optionally inset separators between each appended...
authorLennart Poettering <lennart@poettering.net>
Tue, 28 Nov 2017 15:37:53 +0000 (16:37 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 5 Dec 2017 12:49:12 +0000 (13:49 +0100)
commitbb8ad9eacaaf08078ad08e289c4cef08c7c38663
treefb03ac6998d850aea41debd76d37e54bf10436b3
parent1cfdbe293f0e6266fc63bd807393f0813b8119f0
string-util: rework strextend() to optionally inset separators between each appended string

This adds a new flavour of strextend(), called
strextend_with_separator(), which takes an optional separator string. If
specified, the separator is inserted between each appended string, as
well as before the first one, but only if the original string was
non-empty.

This new call is particularly useful when appending new options to mount
option strings and suchlike, which need to be comma-separated, and
initially start out from an empty string.
src/basic/string-util.c
src/basic/string-util.h
src/test/test-string-util.c