summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-10-18 14:07:51 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-10-18 14:07:51 +0200
commit3189d141522d7d710fa8c7f58e92bffd854088ce (patch)
treeb859f492cbcd38c57d5335e2cddf6557f04b22bf
parentdc5dc3b469decd00609013da578b4a2c83bfe5fc (diff)
downloadsamba-3189d141522d7d710fa8c7f58e92bffd854088ce.tar.gz
samba-3189d141522d7d710fa8c7f58e92bffd854088ce.tar.bz2
samba-3189d141522d7d710fa8c7f58e92bffd854088ce.zip
Use the new memory macro file from Samba 3.
-rw-r--r--lib/util/memory.h8
-rw-r--r--lib/util/util_file.c1
-rw-r--r--lib/util/xfile.c1
-rw-r--r--source3/include/includes.h1
4 files changed, 9 insertions, 2 deletions
diff --git a/lib/util/memory.h b/lib/util/memory.h
index 62686df40d..29dd75060f 100644
--- a/lib/util/memory.h
+++ b/lib/util/memory.h
@@ -40,12 +40,20 @@
/**
* 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
diff --git a/lib/util/util_file.c b/lib/util/util_file.c
index 176ff75e02..0275e78c54 100644
--- a/lib/util/util_file.c
+++ b/lib/util/util_file.c
@@ -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
/**
diff --git a/lib/util/xfile.c b/lib/util/xfile.c
index e8bb811416..94b0ee9b18 100644
--- a/lib/util/xfile.c
+++ b/lib/util/xfile.c
@@ -38,7 +38,6 @@
#if _SAMBA_BUILD_ == 3
#undef malloc
-#define malloc_p(type) malloc(sizeof(type))
#endif
#define XBUFSIZE BUFSIZ
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 7178fb48a8..4926f3ab10 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -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"