X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=talloc%2Ftalloc.h;h=5566a040440a9e71f5d6947ce8f1d60cdddc3443;hp=510cff7599f8d959480b84882b49bd76cfe1e43c;hb=2d6759d42218bef651c0ece58fe36212099a313c;hpb=ec45d0d2bc380e740ad34b2342b3846685a32610;ds=sidebyside diff --git a/talloc/talloc.h b/talloc/talloc.h index 510cff75..5566a040 100644 --- a/talloc/talloc.h +++ b/talloc/talloc.h @@ -1,9 +1,6 @@ #ifndef CCAN_TALLOC_H #define CCAN_TALLOC_H /* - Unix SMB/CIFS implementation. - Samba temporary memory allocation functions - Copyright (C) Andrew Tridgell 2004-2005 Copyright (C) Stefan Metzmacher 2006 @@ -30,6 +27,7 @@ #include #include #include "config.h" +#include "typesafe_cb/typesafe_cb.h" /* this uses a little trick to allow __LINE__ to be stringified @@ -174,10 +172,7 @@ int talloc_free(void *ptr); * talloc, talloc_free */ #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) + _talloc_set_destructor((ptr), typesafe_cb(int, (function), (ptr))) /** * talloc_zero - allocate zeroed dynamic memory for a type