diff options
author | Jay Soffian <jaysoffian@gmail.com> | 2009-02-25 03:32:18 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-02-27 15:19:08 -0800 |
commit | c6f5a7a916b36fc9dd00bb6dce3b68260579abe1 (patch) | |
tree | 179489dbc983e10eb0c10b259eb699c24a38f4a9 /string-list.h | |
parent | 5f48cb95aa0d7311623df76249a1c8a1962550f5 (diff) | |
download | git-c6f5a7a916b36fc9dd00bb6dce3b68260579abe1.tar.gz |
string-list: new for_each_string_list() function
Add a convenience function for iterating over a string_list's items via
a callback.
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'string-list.h')
-rw-r--r-- | string-list.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/string-list.h b/string-list.h index d32ba05202..14bbc477de 100644 --- a/string-list.h +++ b/string-list.h @@ -20,6 +20,11 @@ void string_list_clear(struct string_list *list, int free_util); typedef void (*string_list_clear_func_t)(void *p, const char *str); void string_list_clear_func(struct string_list *list, string_list_clear_func_t clearfunc); +/* Use this function to iterate over each item */ +typedef int (*string_list_each_func_t)(struct string_list_item *, void *); +int for_each_string_list(string_list_each_func_t, + struct string_list *list, void *cb_data); + /* Use these functions only on sorted lists: */ int string_list_has_string(const struct string_list *list, const char *string); int string_list_find_insert_index(const struct string_list *list, const char *string, |