]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
util_strdup: don't use util_memory_a with -DNOTRACK
authorWolfgang Bumiller <blub@speed.at>
Mon, 15 Apr 2013 18:53:53 +0000 (20:53 +0200)
committerWolfgang Bumiller <blub@speed.at>
Mon, 15 Apr 2013 18:53:53 +0000 (20:53 +0200)
gmqcc.h
util.c

diff --git a/gmqcc.h b/gmqcc.h
index 223e0d7559e2ce4e9bb80fedcc482b0a48e88109..2b2fca0e2f8c18ce9c8bed8a0d6203e8a1a09033 100644 (file)
--- 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 2e2aec356822e15913c0bb37986e33499be4f963..c692760f841e12844186812f671ca10b2d31285f 100644 (file)
--- 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';
     }