mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
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:
committed by
Christian Decker
parent
6a3ccafaf9
commit
55d962046b
@@ -580,8 +580,8 @@ struct routing_channel *routing_channel_new(const tal_t *ctx,
|
||||
return chan;
|
||||
}
|
||||
|
||||
static void remove_connection_from_channel(struct node_connection *nc,
|
||||
struct routing_state *rstate)
|
||||
static void destroy_node_connection(struct node_connection *nc,
|
||||
struct routing_state *rstate)
|
||||
{
|
||||
struct routing_channel *chan = uintmap_get(
|
||||
&rstate->channels, short_channel_id_to_uint(&nc->short_channel_id));
|
||||
@@ -600,7 +600,7 @@ void channel_add_connection(struct routing_state *rstate,
|
||||
int direction = get_channel_direction(&nc->src->id, &nc->dst->id);
|
||||
assert(chan != NULL);
|
||||
chan->connections[direction] = nc;
|
||||
tal_add_destructor2(nc, remove_connection_from_channel, rstate);
|
||||
tal_add_destructor2(nc, destroy_node_connection, rstate);
|
||||
}
|
||||
|
||||
static void add_pending_node_announcement(struct routing_state *rstate, struct pubkey *nodeid)
|
||||
|
||||
Reference in New Issue
Block a user