![]() |
![]() |
![]() |
libkmod Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
struct kmod_list; #define kmod_list_foreach (list_entry, first_entry) #define kmod_list_foreach_reverse (list_entry, first_entry) struct kmod_list * kmod_list_last (const struct kmod_list *list
); struct kmod_list * kmod_list_next (const struct kmod_list *list
,const struct kmod_list *curr
); struct kmod_list * kmod_list_prev (const struct kmod_list *list
,const struct kmod_list *curr
);
struct kmod_list * kmod_list_last (const struct kmod_list *list
);
Get the last element of the list
. As list
is a circular list,
this is a cheap operation O(1) with the last element being the
previous element.
If the list has a single element it will return the list itself (as
expected, and this is what differentiates from kmod_list_prev()
).
|
the head of the list |
Returns : |
last node at list or NULL if the list is empty. |
struct kmod_list * kmod_list_next (const struct kmod_list *list
,const struct kmod_list *curr
);
Get the next node in list
relative to curr
as if list
was not a circular
list. I.e. calling this function in the last node of the list returns
NULL.. It can be used to iterate a list by checking for NULL return to know
when all elements were iterated.
|
the head of the list |
|
the current node in the list |
Returns : |
node next to curr or NULL if either this node is the last of or
list is empty. |
struct kmod_list * kmod_list_prev (const struct kmod_list *list
,const struct kmod_list *curr
);
Get the previous node in list
relative to curr
as if list
was not a
circular list. I.e.: the previous of the head is NULL. It can be used to
iterate a list by checking for NULL return to know when all elements were
iterated.
|
the head of the list |
|
the current node in the list |
Returns : |
node previous to curr or NULL if either this node is the head of
the list or the list is empty. |