Rename (almost) all destructors to destroy_<type>.

We usually did this, but sometimes they were named after what they did,
rather than what they cleaned up.

There are still a few exceptions:
1. I didn't bother creating destroy_xxx wrappers for htable routines
   which already existed.
2. Sometimes destructors really are used for side-effects (eg. to simply
   mark that something was freed): these are clearer with boutique names.
3. Generally destructors are static, but they don't need to be: in some
   cases we attach a destructor then remove it later, or only attach
   to *some* cases.  These are best with qualifiers in the destroy_<type>
   name.

Suggested-by: @ZmnSCPxj
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-02-14 12:23:13 +10:30
committed by Christian Decker
parent 6a3ccafaf9
commit 55d962046b
9 changed files with 26 additions and 23 deletions

View File

@@ -8,7 +8,7 @@ struct oneshot {
void *arg;
};
static void remove_timer(struct oneshot *t)
static void destroy_timer(struct oneshot *t)
{
timer_del(t->timers, &t->timer);
}
@@ -25,7 +25,7 @@ struct oneshot *new_reltimer_(struct timers *timers,
t->timers = timers;
timer_init(&t->timer);
timer_addrel(timers, &t->timer, relexpiry);
tal_add_destructor(t, remove_timer);
tal_add_destructor(t, destroy_timer);
return t;
}