summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 45e9a82)
raw | patch | inline | side by side (parent: 45e9a82)
author | Alex Riesen <raa.lkml@gmail.com> | |
Sat, 3 Jul 2010 12:40:04 +0000 (14:40 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 5 Jul 2010 18:44:24 +0000 (11:44 -0700) |
This is more lightweight than a call to for_each_string_list function with
callback function and a cookie argument.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
callback function and a cookie argument.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
string-list.h | patch | blob | history |
diff --git a/string-list.h b/string-list.h
index 680d600d16c095eb167be2eca8c1a7cb94f962af..a37cae599ab61d3d09b08a9cc67e99841cfa6ed6 100644 (file)
--- a/string-list.h
+++ b/string-list.h
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 */
+/* Use this function or the macro below to iterate over each item */
typedef int (*string_list_each_func_t)(struct string_list_item *, void *);
int for_each_string_list(struct string_list *list,
string_list_each_func_t, void *cb_data);
+#define for_each_string_list_item(item,list) \
+ for (item = (list)->items; item < (list)->items + (list)->nr; ++item)
/* Use these functions only on sorted lists: */
int string_list_has_string(const struct string_list *list, const char *string);