From 6ec60c976f6fa990ed1c7efa0ceb7e7634d163c7 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Fri, 19 Aug 2011 03:01:16 +0300 Subject: talloc.[ch]: remove "type safety" hack that violates C types The destructors used by talloc take a "void *" first parameter. However talloc.h had a #define hack that treated the destructor as a function taking first parameter of type "typeof(ptr)" where ptr is the pointer the destructor is set for. I suppose this was done to add some kind of "type safety" against adding a destructor expecting another type of pointer; however this hack is questionable and violates the real C level typing. Remove the hack from the header and adjust talloc.c to avoid a warning about a C type violation that became visible after removing the hack. --- talloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'talloc.c') 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; -- cgit v1.2.3