diff --git a/include/stringlist.h b/include/stringlist.h index 8738137..127998c 100644 --- a/include/stringlist.h +++ b/include/stringlist.h @@ -29,4 +29,7 @@ } } +#define string_list_for_each_entry(entry, sl) \ + list_for_each_entry(entry, &(sl)->list, list) + #endif /* __STRINGLIST_H */ diff --git a/lib/stringlist.c b/lib/stringlist.c index a8af15d..cc84944 100644 --- a/lib/stringlist.c +++ b/lib/stringlist.c @@ -64,7 +64,7 @@ { 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 @@ 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 @@ 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