17 #ifndef CMOCKA_PRIVATE_H_
18 #define CMOCKA_PRIVATE_H_
23 #define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
26 #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
29 #define ZERO_STRUCTP(x) do { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } while(0)
32 #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
35 #define BURN_STRING(x) do { if ((x) != NULL) memset((x), 'X', strlen((x))); } while(0)
49 #define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
54 #define discard_const_p(type, ptr) ((type *)discard_const(ptr))