]> git.ipfire.org Git - thirdparty/git.git/commit
string-list: unify string_list_split* functions
authorJunio C Hamano <gitster@pobox.com>
Fri, 1 Aug 2025 22:04:19 +0000 (15:04 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 3 Aug 2025 05:33:12 +0000 (22:33 -0700)
commit527535fcdd2d9dec56877435f609852d0f2bf163
tree6b4659ef3e35df1f0570d105925c4d266dcc348a
parent9f6dfe43c8a55b833ae16486bcafe29b543461f9
string-list: unify string_list_split* functions

Thanks to the previous step, the only difference between these two
related functions is that string_list_split() works on a string
without modifying its contents (i.e. taking "const char *") and the
resulting pieces of strings are their own copies in a string list,
while string_list_split_in_place() works on a mutable string and the
resulting pieces of strings come from the original string.

Consolidate their implementations into a single helper function, and
make them a thin wrapper around it.  We can later add an extra flags
parameter to extend both of these functions by updating only the
internal helper function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
string-list.c