#define NULL ((void *)(0)) extern void my_fast_free(void *); extern void my_checking_free(void *); static inline void my_kfree( void *ptr ) { if (__builtin_constant_p(ptr!=NULL)) { if (ptr!=NULL) my_fast_free(ptr); } else { my_checking_free(ptr); } } void test( int *bla ) { char *hello = NULL; my_kfree(hello); my_kfree(bla); *bla = 1; /* now it is !=NULL */ my_kfree(bla); }