string-list: optionally omit empty string pieces in string_list_split*()
Teach the unified split_string() machinery a new flag bit, STRING_LIST_SPLIT_NONEMPTY, to cause empty split pieces to be omitted from the resulting string list. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@@ -294,6 +294,9 @@ static int append_one(struct string_list *list,
|
||||
break;
|
||||
}
|
||||
|
||||
if ((flags & STRING_LIST_SPLIT_NONEMPTY) && (end <= p))
|
||||
return 0;
|
||||
|
||||
if (in_place) {
|
||||
*((char *)end) = '\0';
|
||||
string_list_append(list, p);
|
||||
|
||||
Reference in New Issue
Block a user