diff --git a/gmqcc.h b/gmqcc.h index 223e0d7..2b2fca0 100644 --- a/gmqcc.h +++ b/gmqcc.h @@ -317,13 +317,15 @@ int util_asprintf (char **ret, const char *fmt, ...); #ifdef NOTRACK -# define mem_a(x) malloc (x) -# define mem_d(x) free ((void*)x) -# define mem_r(x, n) realloc((void*)x, n) +# define mem_a(x) malloc (x) +# define mem_d(x) free ((void*)x) +# define mem_r(x, n) realloc((void*)x, n) +# define mem_af(x,f,l) malloc (x) #else -# define mem_a(x) util_memory_a((x), __LINE__, __FILE__) -# define mem_d(x) util_memory_d((void*)(x)) -# define mem_r(x, n) util_memory_r((void*)(x), (n), __LINE__, __FILE__) +# define mem_a(x) util_memory_a((x), __LINE__, __FILE__) +# define mem_d(x) util_memory_d((void*)(x)) +# define mem_r(x, n) util_memory_r((void*)(x), (n), __LINE__, __FILE__) +# define mem_af(x) util_memory_a((x), __LINE__, __FILE__) #endif /*! NOTRACK */ #define util_strdup(X) _util_Estrdup((X), __FILE__, __LINE__) diff --git a/util.c b/util.c index 2e2aec3..c692760 100644 --- a/util.c +++ b/util.c @@ -163,10 +163,14 @@ char *_util_Estrdup(const char *s, const char *file, size_t line) { size_t len = 0; char *ptr = NULL; + /* in case of -DNOTRACK */ + (void)file; + (void)line; + if (!s) return NULL; - if ((len = strlen(s)) && (ptr = (char*)util_memory_a(len+1, line, file))) { + if ((len = strlen(s)) && (ptr = (char*)mem_af(len+1, line, file))) { memcpy(ptr, s, len); ptr[len] = '\0'; }