X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=talloc%2Ftalloc.h;h=5566a040440a9e71f5d6947ce8f1d60cdddc3443;hb=c8acddea39d222312102952e91c32cfe4dd2cea0;hp=b73164093c043924bce74da8b30ea48be0b7b497;hpb=9927eebe7c5c257c990d86baaa8760994195d48b;p=ccan diff --git a/talloc/talloc.h b/talloc/talloc.h index b7316409..5566a040 100644 --- a/talloc/talloc.h +++ b/talloc/talloc.h @@ -27,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 @@ -171,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