Commit e15af112 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

cocci: Masquerade foreach loops as if statements

Inside the loop the element is in fact, not null. Only one occurrence
was caught by check_obj.cocci, which shows that more code is still not
understood by Coccinelle. For example, it doesn't seem to enjoy #undef
directives inside functions.
parent 35b51e28
......@@ -320,7 +320,7 @@ hcb_cleaner(struct worker *wrk, void *priv)
FREE_OBJ(y);
}
VTAILQ_FOREACH_SAFE(oh, &dead_h, hoh_list, oh2) {
CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC);
CHECK_OBJ(oh, OBJHEAD_MAGIC);
VTAILQ_REMOVE(&dead_h, oh, hoh_list);
HSH_DeleteObjHead(wrk, oh);
}
......
......@@ -24,6 +24,10 @@
#define VTAILQ_HEAD_INITIALIZER(t) 0
#define VSTAILQ_HEAD_INITIALIZER(t) 0
#define VTAILQ_FOREACH(o, h, l) if (o != NULL)
#define VTAILQ_FOREACH_SAFE(o, h, l, o2) if (o != NULL)
#define VTAILQ_FOREACH_REVERSE(o, h, t, l) if (o != NULL)
/* include/vtree.h */
#define VRBT_ENTRY(x) unsigned
#define VRBT_HEAD(x, y) unsigned
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment