chiark / gitweb /
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)
committerSven Eden <yamakuzure@gmx.net>
Tue, 28 Nov 2017 15:37:53 +0000 (16:37 +0100)
commit14728b9406dccbf6a74f21aaa1cc524273edbb15
tree4fc519fe247975bf439aa82531799b18eb6de4de
parent8a5a474e846f8810cb3861ed869da35db74f9a97
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