Using macro to check null values
- by poliron
My C code contains many functions with pointers to different structs as parameters which shouldn't be NULL pointers. To make my code more readable, I decided to replace this code:
if(arg1==NULL || arg2==NULL || arg3==NULL...) {
return SOME_ERROR;
}
With that macro:
NULL_CHECK(arg1,arg2,...)
How should I write it, if the number of args is unknown and they can point to different structs?(I work in C99)