1
0
Fork 0

LinkList: Add Lth_ListForEach and Lth_ListFor

This uses some extensions David JUST implemented into GDCC.
master
Marrub 2016-10-17 19:12:31 -04:00
parent a0e68bab91
commit d9929aadd3
2 changed files with 13 additions and 0 deletions

View File

@ -46,6 +46,11 @@ Lth_X(SIGUPDATE , update, void, struct Lth_Context *, struct Lth_Control *)
(name).data[cbIter - 1](__VA_ARGS__); \
} \
while(0)
#define Lth_ControlCall(ctrl, name, ...) \
Lth_ListForEach(Lth_Control *owner, ctrl->descendants) \
Lth_Call(owner->cb.name, __VA_ARGS__); \
\
Lth_Call(ctrl->cb.name, __VA_ARGS__)
//----------------------------------------------------------------------------|

View File

@ -17,6 +17,14 @@
#include <stddef.h>
#define Lth_ListForEach(tmpv, lst) \
for(Lth_LinkList *list = (lst); list; list = list->next) \
__with(tmpv = list->owner;)
#define Lth_ListFor(tmpv, lst) \
for(Lth_LinkList *list = (lst); list;) \
__with(Lth_LinkList *next = list->next, **prev = list->prev; \
tmpv = list->owner;)
//----------------------------------------------------------------------------|
// Type Definitions |