diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-11-15 10:24:53 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-11-15 10:24:53 -0800 |
commit | 6050b5bca0f6d94d1d171d60b64ace87651383a1 (patch) | |
tree | 44c3e843fbe45bc88b5aa3cb0b537f52d386a995 /string-list.c | |
parent | 2be3d85a1c3760cba0960723ffed165f45fa36c6 (diff) | |
parent | 6fa23773d2fa257cf45fb20640d6286d13ded852 (diff) | |
download | git-6050b5bca0f6d94d1d171d60b64ace87651383a1.tar.gz |
Merge branch 'mh/notes-string-list'
Improve the asymptotic performance of the cat_sort_uniq notes merge
strategy.
* mh/notes-string-list:
string_list_add_refs_from_colon_sep(): use string_list_split()
notes: fix handling of colon-separated values
combine_notes_cat_sort_uniq(): sort and dedup lines all at once
Initialize sort_uniq_list using named constant
string_list: add a function string_list_remove_empty_items()
Diffstat (limited to 'string-list.c')
-rw-r--r-- | string-list.c | 9 |
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) { |