feat(vars): $@ and $* init
This commit is contained in:
parent
00c2b9c979
commit
32d38c0d13
3 changed files with 74 additions and 6 deletions
|
|
@ -107,4 +107,9 @@ int list_find(struct list *list, void *value);
|
|||
// struct list *list_split(struct list *list, size_t index);
|
||||
// END PROTO list_split
|
||||
|
||||
/**
|
||||
* @brief: Folds the list from left to right using func and an accumulator.
|
||||
*/
|
||||
void list_fold(struct list *list, void *acc, void (*func)(void *, void *));
|
||||
|
||||
#endif /* ! LISTS_H */
|
||||
|
|
|
|||
|
|
@ -115,3 +115,13 @@ void list_deep_destroy(struct list *l)
|
|||
elt = next_elt;
|
||||
}
|
||||
}
|
||||
|
||||
void list_fold(struct list *list, void *acc, void (*func)(void *, void *))
|
||||
{
|
||||
struct list *elt = list;
|
||||
while (elt != NULL)
|
||||
{
|
||||
func(acc, elt->data);
|
||||
elt = elt->next;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue