From: Roger Dingledine Date: Fri, 30 Nov 2007 19:02:56 +0000 (+0000) Subject: make dmalloc 5.4.2 work again too X-Git-Tag: tor-0.2.0.13-alpha~125 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fa2c3a73e4dbbe69c311d6a2ded4e5cc0d6be665;p=thirdparty%2Ftor.git make dmalloc 5.4.2 work again too svn:r12615 --- diff --git a/configure.in b/configure.in index a5aeb47439..88bac18926 100644 --- a/configure.in +++ b/configure.in @@ -500,6 +500,7 @@ if [[ $dmalloc -eq 1 ]]; then 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 diff --git a/src/common/util.c b/src/common/util.c index 03670c503b..ffbd0e6c0b 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -79,8 +79,17 @@ const char util_c_id[] = "$Id$"; #undef strndup #include #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) \