From: Emil Velikov Date: Mon, 2 Sep 2024 22:20:19 +0000 (+0100) Subject: libkmod/docs: document kmod_list iterators X-Git-Tag: v34~426 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ffdbccefc280ceed05b681e40f91ba1555d1662e;p=thirdparty%2Fkmod.git libkmod/docs: document kmod_list iterators ... and change the argument names to match the other kmod_list APIs. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/94 Signed-off-by: Lucas De Marchi --- diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h index 2883d155..cf440c97 100644 --- a/libkmod/libkmod.h +++ b/libkmod/libkmod.h @@ -267,15 +267,29 @@ const char *kmod_get_dirname(const struct kmod_ctx *ctx); */ struct kmod_list; -#define kmod_list_foreach(list_entry, first_entry) \ - for (list_entry = first_entry; \ - list_entry != NULL; \ - list_entry = kmod_list_next(first_entry, list_entry)) - -#define kmod_list_foreach_reverse(list_entry, first_entry) \ - for (list_entry = kmod_list_last(first_entry); \ - list_entry != NULL; \ - list_entry = kmod_list_prev(first_entry, list_entry)) +/** + * kmod_list_foreach: + * @curr: the current node in the list + * @list: the head of the list + * + * Iterate over the list @list. + */ +#define kmod_list_foreach(curr, list) \ + for (curr = list; \ + curr != NULL; \ + curr = kmod_list_next(list, curr)) + +/** + * kmod_list_foreach_reverse: + * @curr: the current node in the list + * @list: the head of the list + * + * Iterate in reverse over the list @list. + */ +#define kmod_list_foreach_reverse(curr, list) \ + for (curr = kmod_list_last(list); \ + curr != NULL; \ + curr = kmod_list_prev(list, curr)) /** * kmod_list_last: