r4472: improve the discard_const() macro for standalone build of talloc
authorAndrew Tridgell <tridge@samba.org>
Sun, 2 Jan 2005 04:21:32 +0000 (04:21 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:07:55 +0000 (13:07 -0500)
(This used to be commit 310cea15bf01343d9ab8ff7a166f0699c0507816)

source4/lib/talloc.c

index 7f502648011e55b59069ef9e245e3fec5ad47e79..ce1a325ebd72364efd4ca524fa41efc0363ec38a 100644 (file)
@@ -34,6 +34,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
+#include <stdint.h>
 #include "talloc.h"
 #endif
 
 #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