From 6bb2a1377b4b7a044f69d0107c38479180694fac Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Sun, 4 Nov 2012 08:07:06 +0100 Subject: string_list: add a function string_list_remove_empty_items() Signed-off-by: Michael Haggerty Acked-by: Johan Herland Signed-off-by: Jeff King --- string-list.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'string-list.h') diff --git a/string-list.h b/string-list.h index 5efd07b44e..c50b0d0dea 100644 --- a/string-list.h +++ b/string-list.h @@ -38,6 +38,13 @@ int for_each_string_list(struct string_list *list, void filter_string_list(struct string_list *list, int free_util, string_list_each_func_t want, void *cb_data); +/* + * Remove any empty strings from the list. If free_util is true, call + * free() on the util members of any items that have to be deleted. + * Preserve the order of the items that are retained. + */ +void string_list_remove_empty_items(struct string_list *list, int free_util); + /* * Return the longest string in prefixes that is a prefix (in the * sense of prefixcmp()) of string, or NULL if no such prefix exists. -- cgit v1.3-5-g9baa