diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-06-24 12:07:00 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-07-03 09:39:16 +0200 |
commit | 6dd613f1bcf323507c7c6a6131bfb5a985a06c85 (patch) | |
tree | 69f787bf60704664d62f62a5851d26a7590468c6 /lib | |
parent | 9d6df5154284d5909294d7b13195ca41500ff79a (diff) | |
download | barebox-6dd613f1bcf323507c7c6a6131bfb5a985a06c85.tar.gz barebox-6dd613f1bcf323507c7c6a6131bfb5a985a06c85.tar.xz |
string_list: Add string_list_for_each_entry macro
To ease iterating over a string_list.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/stringlist.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/stringlist.c b/lib/stringlist.c index a8af15d757..cc84944f73 100644 --- a/lib/stringlist.c +++ b/lib/stringlist.c @@ -64,7 +64,7 @@ int string_list_contains(struct string_list *sl, char *str) { struct string_list *entry; - list_for_each_entry(entry, &sl->list, list) { + string_list_for_each_entry(entry, sl) { if (!strcmp(str, entry->str)) return 1; } @@ -77,7 +77,7 @@ void string_list_print_by_column(struct string_list *sl) int len = 0, num, i; struct string_list *entry; - list_for_each_entry(entry, &sl->list, list) { + string_list_for_each_entry(entry, sl) { int l = strlen(entry->str) + 4; if (l > len) len = l; @@ -91,7 +91,7 @@ void string_list_print_by_column(struct string_list *sl) num = 1; i = 0; - list_for_each_entry(entry, &sl->list, list) { + string_list_for_each_entry(entry, sl) { if (!(++i % num)) printf("%s\n", entry->str); else |