mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-04 22:00:19 -05:00
Adds filter exclusion.
Some refactoring.
This commit is contained in:
parent
c2d113685e
commit
b9b8fd0bb8
24 changed files with 687 additions and 217 deletions
26
tommylist.h
26
tommylist.h
|
|
@ -305,5 +305,31 @@ tommy_inline tommy_bool_t tommy_list_empty(tommy_list* list)
|
|||
return tommy_list_head(list) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the specified function for each element in the list.
|
||||
*/
|
||||
tommy_inline void tommy_list_foreach(tommy_list* list, tommy_foreach_func* func)
|
||||
{
|
||||
tommy_node* node = tommy_list_head(list);
|
||||
while (node) {
|
||||
void* data = node->data;
|
||||
node = node->next;
|
||||
func(data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the specified function with argument for each element in the list.
|
||||
*/
|
||||
tommy_inline void tommy_list_foreach_arg(tommy_list* list, tommy_foreach_arg_func* func, void* arg)
|
||||
{
|
||||
tommy_node* node = tommy_list_head(list);
|
||||
while (node) {
|
||||
void* data = node->data;
|
||||
node = node->next;
|
||||
func(arg, data);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue