-static struct destructor *add_destructor_property(struct tal_hdr *t,
- void (*destroy)(void *))
-{
- struct destructor *prop = allocate(sizeof(*prop));
- if (prop) {
- init_property(&prop->hdr, t, DESTRUCTOR);
- prop->destroy = destroy;
- }
- return prop;
-}
-
-static bool del_destructor_property(struct tal_hdr *t,
- void (*destroy)(void *))
-{
- struct prop_hdr **p;
-
- for (p = (struct prop_hdr **)&t->prop; *p; p = &(*p)->next) {
- struct destructor *d;
-
- if (is_literal(*p))
- break;
- if ((*p)->type != DESTRUCTOR)
- continue;
- d = (struct destructor *)*p;
- if (d->destroy == destroy) {
- *p = (*p)->next;
- freefn(d);
- return true;
- }
- }
- return false;
-}
-