summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--talloc.c3
-rw-r--r--talloc.h9
2 files changed, 4 insertions, 8 deletions
diff --git a/talloc.c b/talloc.c
index 63550cf4d4..87842c5acd 100644
--- a/talloc.c
+++ b/talloc.c
@@ -432,8 +432,9 @@ int talloc_increase_ref_count(const void *ptr)
this is referenced by a function pointer and should not be inline
*/
-static int talloc_reference_destructor(struct talloc_reference_handle *handle)
+static int talloc_reference_destructor(void *ptr)
{
+ struct talloc_reference_handle *handle = ptr;
struct talloc_chunk *ptr_tc = talloc_chunk_from_ptr(handle->ptr);
_TLIST_REMOVE(ptr_tc->refs, handle);
return 0;
diff --git a/talloc.h b/talloc.h
index 8c6d405040..b60e0fb040 100644
--- a/talloc.h
+++ b/talloc.h
@@ -70,20 +70,15 @@ typedef void TALLOC_CTX;
if we have a recent gcc */
#if (__GNUC__ >= 3)
#define _TALLOC_TYPEOF(ptr) __typeof__(ptr)
-#define talloc_set_destructor(ptr, function) \
- do { \
- int (*_talloc_destructor_fn)(_TALLOC_TYPEOF(ptr)) = (function); \
- _talloc_set_destructor((ptr), (int (*)(void *))_talloc_destructor_fn); \
- } while(0)
/* this extremely strange macro is to avoid some braindamaged warning
stupidity in gcc 4.1.x */
#define talloc_steal(ctx, ptr) ({ _TALLOC_TYPEOF(ptr) __talloc_steal_ret = (_TALLOC_TYPEOF(ptr))_talloc_steal((ctx),(ptr)); __talloc_steal_ret; })
#else
-#define talloc_set_destructor(ptr, function) \
- _talloc_set_destructor((ptr), (int (*)(void *))(function))
#define _TALLOC_TYPEOF(ptr) void *
#define talloc_steal(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_steal((ctx),(ptr))
#endif
+#define talloc_set_destructor(ptr, function) \
+ _talloc_set_destructor((ptr), (function))
#define talloc_reference(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_reference((ctx),(ptr))
#define talloc_move(ctx, ptr) (_TALLOC_TYPEOF(*(ptr)))_talloc_move((ctx),(void *)(ptr))