summaryrefslogtreecommitdiff
path: root/notes.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-08-01 15:04:23 -0700
committerJunio C Hamano <gitster@pobox.com>2025-08-02 22:34:45 -0700
commit2ab2aac73d234ae75096e2186b07cc14c57d2586 (patch)
tree649169187f4fa82992977d92c11e6bac5e2a474d /notes.c
parent27531efa41cfa882473513dd93e696a16f6eb87b (diff)
string-list: split-then-remove-empty can be done while splitting
Thanks to the new STRING_LIST_SPLIT_NONEMPTY flag, a common pattern to split a string into a string list and then remove empty items in the resulting list is no longer needed. Instead, just tell the string_list_split*() to omit empty ones while splitting. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'notes.c')
-rw-r--r--notes.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/notes.c b/notes.c
index 6afcf088b9..3603c4a42b 100644
--- a/notes.c
+++ b/notes.c
@@ -970,8 +970,8 @@ void string_list_add_refs_from_colon_sep(struct string_list *list,
char *globs_copy = xstrdup(globs);
int i;
- string_list_split_in_place(&split, globs_copy, ":", -1);
- string_list_remove_empty_items(&split, 0);
+ string_list_split_in_place_f(&split, globs_copy, ":", -1,
+ STRING_LIST_SPLIT_NONEMPTY);
for (i = 0; i < split.nr; i++)
string_list_add_refs_by_glob(list, split.items[i].string);