X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftal%2Ftal.h;h=7efc824ab9da37b806f159d7107caf57bef66c18;hp=42245f68660277c990561502f50b00f94297bcb5;hb=ca6991d861a02d1da8d51f71607a4d9d8e145850;hpb=d73447c20d96b86a731ddae5efc0c09a533d3a52 diff --git a/ccan/tal/tal.h b/ccan/tal/tal.h index 42245f68..7efc824a 100644 --- a/ccan/tal/tal.h +++ b/ccan/tal/tal.h @@ -130,6 +130,17 @@ void *tal_free(const tal_t *p); #define tal_add_destructor(ptr, function) \ tal_add_destructor_((ptr), typesafe_cb(void, void *, (function), (ptr))) +/** + * tal_del_destructor - remove a destructor callback function. + * @ptr: The tal allocated object. + * @function: the function to call before it's freed. + * + * If @function has not been successfully added as a destructor, this returns + * false. + */ +#define tal_del_destructor(ptr, function) \ + tal_del_destructor_((ptr), typesafe_cb(void, void *, (function), (ptr))) + /** * tal_set_name - attach a name to a tal pointer. * @ptr: The tal allocated object. @@ -324,5 +335,6 @@ tal_t *tal_steal_(const tal_t *new_parent, const tal_t *t); bool tal_resize_(tal_t **ctxp, size_t size); bool tal_add_destructor_(tal_t *ctx, void (*destroy)(void *me)); +bool tal_del_destructor_(tal_t *ctx, void (*destroy)(void *me)); #endif /* CCAN_TAL_H */