Use the new memory macro file from Samba 3.
authorJelmer Vernooij <jelmer@samba.org>
Sat, 18 Oct 2008 12:07:51 +0000 (14:07 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 18 Oct 2008 12:07:51 +0000 (14:07 +0200)
lib/util/memory.h
lib/util/util_file.c
lib/util/xfile.c
source3/include/includes.h

index 62686df40d0c54047436586f27539405262664ca..29dd75060f96bb156ab2de8979c7f4b26ea463e4 100644 (file)
 /**
  * Allocate an array of elements of one data type. Does type-checking.
  */
+#if _SAMBA_BUILD_ == 3
+#define malloc_array_p(type, count) (type *)realloc_array(NULL, sizeof(type), count, false)
+#else
 #define malloc_array_p(type, count) (type *)realloc_array(NULL, sizeof(type), count)
+#endif
 
 /** 
  * Resize an array of elements of one data type. Does type-checking.
  */
+#if _SAMBA_BUILD_ == 3
+#define realloc_p(p, type, count) (type *)realloc_array(p, sizeof(type), count, false)
+#else
 #define realloc_p(p, type, count) (type *)realloc_array(p, sizeof(type), count)
+#endif
 
 /** 
  * zero a structure 
index 176ff75e02610f59fb7829ca7ded00462d0ee19e..0275e78c54fc89f3a69d2539c82874ea1ce10878 100644 (file)
@@ -25,7 +25,6 @@
 #if _SAMBA_BUILD_ == 3
 #undef malloc
 #undef realloc
-#define realloc_p(p, type, count) (type *)realloc_array(p, sizeof(type), count, false)
 #endif
 
 /**
index e8bb811416a34c46a4e44031127666effdbd3754..94b0ee9b1897d28f9480d72d369e8d8077b8b458 100644 (file)
@@ -38,7 +38,6 @@
 
 #if _SAMBA_BUILD_ == 3
 #undef malloc
-#define malloc_p(type) malloc(sizeof(type))
 #endif
 
 #define XBUFSIZE BUFSIZ
index 7178fb48a80096095a7a99b9fdc30844464ff64c..4926f3ab10d54858f616d693358e36cf4e84e7a6 100644 (file)
@@ -592,6 +592,7 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx);
 
 /* Lists, trees, caching, database... */
 #include "../lib/util/xfile.h"
+#include "../lib/util/memory.h"
 #include "intl.h"
 #include "../lib/util/dlinklist.h"
 #include "tdb.h"