chiark / gitweb /
basic/strv: fix strv_join for first empty argument
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 12 Feb 2016 04:24:14 +0000 (23:24 -0500)
committerSven Eden <yamakuzure@gmx.net>
Fri, 16 Jun 2017 08:12:57 +0000 (10:12 +0200)
commit6766baac570c65a49f0eed23f181af1cab52b37f
treeaf96c2c1b70906eeb6a6d32c62dbf31a59006dd4
parentf392163119aa4b0e9680db2d61ae41374b465d46
basic/strv: fix strv_join for first empty argument

Empty strings were ignored in strv_join, but only if they were at the beginning
of the string. Empty strings after at least one non-empty item were treated
normally.

Previously:
{"x"} → "x"
{"x", ""} → "x"
{"x", "", ""} → "x::"
{""} → ""
{"", ""} → ""
{"", "", ""} → ""
{"", "x"} → "x"
{"", "x", ""} → "x:"
Now:
{"x"} → "x"
{"x", ""} → "x"
{"x", "", ""} → "x::"
{""} → ""
{"", ""} → ":"
{"", "", ""} → "::"
{"", "x"} → ":x"
{"", "x", ""} → ":x:"
src/basic/strv.c