Cleaned up all list iterations, added macro named LIST_FOREACH.
Previously you would have to do something like this:
for (type foo = (type) list_get_first(list); foo; foo = (type) list_get_next(list)
{
/* code */
}
Now, you can instead write this as:
LIST_FOREACH(type, foo, list,
{
/* code */
})
Basically, boilerplate stuff including the casting is gone.
This commit is contained in:
@@ -27,13 +27,12 @@
|
||||
PLUGIN_DEBUG(HUB, # FUNCNAME) \
|
||||
if (HUB->plugins && HUB->plugins->loaded) \
|
||||
{ \
|
||||
struct plugin_handle* plugin = (struct plugin_handle*) list_get_first(HUB->plugins->loaded); \
|
||||
while (plugin) \
|
||||
struct plugin_handle* plugin;\
|
||||
LIST_FOREACH(struct plugin_handle*, plugin, HUB->plugins->loaded, \
|
||||
{ \
|
||||
if (plugin->funcs.FUNCNAME) \
|
||||
CODE \
|
||||
plugin = (struct plugin_handle*) list_get_next(HUB->plugins->loaded); \
|
||||
} \
|
||||
}); \
|
||||
}
|
||||
|
||||
#define PLUGIN_INVOKE_STATUS_1(HUB, FUNCNAME, ARG1) \
|
||||
|
||||
Reference in New Issue
Block a user