[or-cvs] r12615: make dmalloc 5.4.2 work again too (in tor/trunk: . src/common)

arma at seul.org arma at seul.org
Fri Nov 30 19:02:56 UTC 2007


Author: arma
Date: 2007-11-30 14:02:56 -0500 (Fri, 30 Nov 2007)
New Revision: 12615

Modified:
   tor/trunk/configure.in
   tor/trunk/src/common/util.c
Log:
make dmalloc 5.4.2 work again too


Modified: tor/trunk/configure.in
===================================================================
--- tor/trunk/configure.in	2007-11-30 18:53:14 UTC (rev 12614)
+++ tor/trunk/configure.in	2007-11-30 19:02:56 UTC (rev 12615)
@@ -500,6 +500,7 @@
   AC_SEARCH_LIBS(dmalloc_malloc, [dmallocth dmalloc], , AC_MSG_ERROR(Libdmalloc library not found. If you enable it you better have it installed.))
   AC_DEFINE(USE_DMALLOC, 1, [Debug memory allocation library])
   AC_DEFINE(DMALLOC_FUNC_CHECK, 1, [Enable dmalloc's malloc function check])
+  AC_CHECK_FUNCS(dmalloc_strdup dmalloc_strndup)
 fi
 
 # Allow user to specify an alternate syslog facility

Modified: tor/trunk/src/common/util.c
===================================================================
--- tor/trunk/src/common/util.c	2007-11-30 18:53:14 UTC (rev 12614)
+++ tor/trunk/src/common/util.c	2007-11-30 19:02:56 UTC (rev 12615)
@@ -79,8 +79,17 @@
  #undef strndup
  #include <dmalloc.h>
  #define DMALLOC_FN_ARGS , file, line
- #define dmalloc_strdup(file, line, string, xalloc_b) dmalloc_strndup(file, line, (string), -1, xalloc_b)
-#else
+
+ #if defined(HAVE_DMALLOC_STRDUP)
+ /* the dmalloc_strdup should be fine as defined */
+ #elif defined(HAVE_DMALLOC_STRNDUP)
+ #define dmalloc_strdup(file, line, string, xalloc_b) \
+         dmalloc_strndup(file, line, (string), -1, xalloc_b)
+ #else
+ #error "No dmalloc_strdup or equivalent"
+ #endif
+
+#else /* not using dmalloc */
  #define dmalloc_strdup(file, line, string, xalloc_b) strdup(string)
 
  #define dmalloc_malloc(file, line, size, func_id, alignment, xalloc_b) \



More information about the tor-commits mailing list