Here is a drop in fix so you guys don't have to change your ent_next code.
ENTITY *__ent_next_fixed(ENTITY *ent)
{
while((ent = ent_next(ent)))
{
if(ent->type != NULL)
return ent;
}
return NULL;
}
#define ent_next __ent_next_fixed
Edit: Just remembered that Lite-C has result as reserved keyword and that it doesn't support early termination of expressions... Oh well, there goes the elegant function.
Edit 2: Added some elegance back
Edit 3: In case Lite-C ever supports it, here is a elegant three liner:
ENTITY *__ent_next_fixed(ENTITY *ent)
{
while((ent = ent_next(ent)) && ent->type == NULL)
;
return ent;
}