string_list: add a function string_list_remove_empty_items()
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Acked-by: Johan Herland <johan@herland.net> Signed-off-by: Jeff King <peff@peff.net>
This commit is contained in:

committed by
Jeff King

parent
9c50374497
commit
6bb2a1377b
@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user