summaryrefslogtreecommitdiff
path: root/string-list.c
diff options
context:
space:
mode:
Diffstat (limited to 'string-list.c')
-rw-r--r--string-list.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/string-list.c b/string-list.c
index c54b816244..397e6cfa7d 100644
--- a/string-list.c
+++ b/string-list.c
@@ -136,6 +136,15 @@ void filter_string_list(struct string_list *list, int free_util,
list->nr = dst;
}
+static int item_is_not_empty(struct string_list_item *item, void *unused)
+{
+ return *item->string != '\0';
+}
+
+void string_list_remove_empty_items(struct string_list *list, int free_util) {
+ filter_string_list(list, free_util, item_is_not_empty, NULL);
+}
+
char *string_list_longest_prefix(const struct string_list *prefixes,
const char *string)
{