r6660: Sorry for the spam... I think now I've got a version that should compile on
authorVolker Lendecke <vlendec@samba.org>
Sat, 7 May 2005 22:10:26 +0000 (22:10 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:16:32 +0000 (13:16 -0500)
trunk, 3_0 and 4_0.

Volker
(This used to be commit 777c489cad610fef140ec80d5644111b04a314c1)

source4/lib/talloc/talloc.c
source4/lib/talloc/testsuite.c

index cb5e91341ef996336b72c0b14f9a04049726027d..3650ab7f51b7469aca378a6bf8ebe5b54a776a0d 100644 (file)
 
 #ifdef _SAMBA_BUILD_
 #include "includes.h"
+#if ((SAMBA_VERSION_MAJOR==3)&&(SAMBA_VERSION_MINOR<9))
+/* This is to circumvent SAMBA3's paranoid malloc checker. Here in this file
+ * we trust ourselves... */
+#ifdef malloc
+#undef malloc
+#endif
+#ifdef realloc
+#undef realloc
+#endif
+#endif
 #else
 #include <stdio.h>
 #include <stdlib.h>
@@ -1081,7 +1091,6 @@ void *talloc_autofree_context(void)
        return cleanup_context;
 }
 
-
 size_t talloc_get_size(const void *context)
 {
        struct talloc_chunk *tc;
index 967874917d27b257793aa7f9ba028b35ce2858f2..0447749abdeca0c6cd9b3e2e77c8689df29c719a 100644 (file)
 /* the test suite can be built standalone, or as part of Samba */
 #ifndef _SAMBA_BUILD_
 typedef enum {False=0,True=1} BOOL;
+#endif
+
+/* Samba3 does not define the timeval functions below */
+#if !defined(_SAMBA_BUILD_) || ((SAMBA_VERSION_MAJOR==3)&&(SAMBA_VERSION_MINOR<9))
 
 static struct timeval timeval_current(void)
 {
@@ -51,6 +55,14 @@ static double timeval_elapsed(struct timeval *tv)
 }
 #endif /* _SAMBA_BUILD_ */
 
+#if SAMBA_VERSION_MAJOR<4
+#ifdef malloc
+#undef malloc
+#endif
+#ifdef strdup
+#undef strdup
+#endif
+#endif
 
 #define CHECK_SIZE(ptr, tsize) do { \
        if (talloc_total_size(ptr) != (tsize)) { \
@@ -827,7 +839,7 @@ BOOL torture_local_talloc(void)
 
 
 
-#ifndef _SAMBA_BUILD_
+#if !defined(_SAMBA_BUILD_) || ((SAMBA_VERSION_MAJOR==3)&&(SAMBA_VERSION_MINOR<9))
  int main(void)
 {
        if (!torture_local_talloc()) {