4848 fprintf(stderr, "XXX ERROR:%s:%s:%d XXX: ",__FILE__,__FUNCTION__,__LINE__);\
4949 fprintf(stderr, fmt, ## args);} while (0)
5050
51- #define CHECK
51+ #define CHECK
5252
5353/* debug assert (completely removed in release version) */
54- //#define DASSERT(b,action)
54+ //#define DASSERT(b,action)
5555
5656/* must success (check omitted in release version) */
5757//#define MUST(b,action) do {if ((b)){}} while (0)
7575/* Defining infinite time */
7676#define FOREVER -1
7777
78- #define CLEAR (x ) memset (&(x), 0, sizeof (x))
7978#define CLOSE (x ) do{if((x)>0){close(x);(x) = 0;}}while(0)
8079#define FCLOSE (x ) do{if((x)!=NULL){fclose(x);(x) = NULL;}}while(0)
8180#define ALLOC (t ) (t = (typeof(t))calloc(1,sizeof(typeof(*(t)))))
8281#define NEW (t ) ((t *)calloc(1,sizeof(t)))
8382
83+ #ifndef CLEAR
84+ #define CLEAR (x ) memset (&(x), 0, sizeof (x))
85+ #endif
8486#define COPY (x ,y ) memcpy ((x),(y),sizeof (*(y)))
8587//#define FREE(h) do { if(h){printf("freeing 0x%08x\n",(unsigned int)h);free(h);h=NULL;}else{DBG("freeing NULL pointer\n");}} while (0);
8688#define FREE (h ) do { if(h){free(h);h=NULL;}} while (0);
8789
8890/* common object creation macro: calloc given pointer. when failed, perform 'action' */
8991#define TALLOC (h ,action ) do {h=NULL;if(!(ALLOC(h))){ERR("No memory!\n");action;}} while (0)
90-
92+
9193#ifndef max
9294#define max (a ,b ) ((a)>(b)?(a):(b))
9395#endif
@@ -162,4 +164,4 @@ gbl_set_quit(struct global_state_t *gbl)
162164 pthread_mutex_unlock (& gbl -> mutex );
163165}
164166
165- #endif
167+ #endif
0 commit comments