summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/lib/talloc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source4/lib/talloc.c b/source4/lib/talloc.c
index 7f50264801..ce1a325ebd 100644
--- a/source4/lib/talloc.c
+++ b/source4/lib/talloc.c
@@ -34,6 +34,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
+#include <stdint.h>
#include "talloc.h"
#endif
@@ -54,7 +55,11 @@
#endif
#ifndef discard_const_p
-#define discard_const_p(type, ptr) ((type *)(ptr))
+#if defined(__intptr_t_defined) || defined(HAVE_INTPTR_T)
+# define discard_const_p(type, ptr) ((type *)((intptr_t)(ptr)))
+#else
+# define discard_const_p(type, ptr) ((type *)(ptr))
+#endif
#endif
/* this null_context is only used if talloc_enable_leak_report() or