diff --git a/common/timeout.c b/common/timeout.c index ca1ca636a..1e3a430e6 100644 --- a/common/timeout.c +++ b/common/timeout.c @@ -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; } diff --git a/gossipd/routing.c b/gossipd/routing.c index 756ed15d0..fd16bd494 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -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) diff --git a/lightningd/chaintopology.c b/lightningd/chaintopology.c index 6fb7d60f5..cac3cfe7f 100644 --- a/lightningd/chaintopology.c +++ b/lightningd/chaintopology.c @@ -681,7 +681,7 @@ void chaintopology_mark_pointers_used(struct htable *memtable, /* On shutdown, channels get deleted last. That frees from our list, so * do it now instead. */ -static void destroy_outgoing_txs(struct chain_topology *topo) +static void destroy_chain_topology(struct chain_topology *topo) { struct outgoing_tx *otx; @@ -724,7 +724,7 @@ void setup_topology(struct chain_topology *topo, bitcoind_getblockcount(topo->bitcoind, get_init_blockhash, topo); - tal_add_destructor(topo, destroy_outgoing_txs); + tal_add_destructor(topo, destroy_chain_topology); /* Begin fee estimation. */ start_fee_estimate(topo); diff --git a/lightningd/htlc_end.c b/lightningd/htlc_end.c index 38fd7bd4a..d18ea072f 100644 --- a/lightningd/htlc_end.c +++ b/lightningd/htlc_end.c @@ -28,14 +28,14 @@ struct htlc_in *find_htlc_in(const struct htlc_in_map *map, return htlc_in_map_get(map, &key); } -static void remove_htlc_in(struct htlc_in *hend, struct htlc_in_map *map) +static void destroy_htlc_in(struct htlc_in *hend, struct htlc_in_map *map) { htlc_in_map_del(map, hend); } void connect_htlc_in(struct htlc_in_map *map, struct htlc_in *hend) { - tal_add_destructor2(hend, remove_htlc_in, map); + tal_add_destructor2(hend, destroy_htlc_in, map); htlc_in_map_add(map, hend); } @@ -47,14 +47,14 @@ struct htlc_out *find_htlc_out(const struct htlc_out_map *map, return htlc_out_map_get(map, &key); } -static void remove_htlc_out(struct htlc_out *hend, struct htlc_out_map *map) +static void destroy_htlc_out(struct htlc_out *hend, struct htlc_out_map *map) { htlc_out_map_del(map, hend); } void connect_htlc_out(struct htlc_out_map *map, struct htlc_out *hend) { - tal_add_destructor2(hend, remove_htlc_out, map); + tal_add_destructor2(hend, destroy_htlc_out, map); htlc_out_map_add(map, hend); } diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index 4af1e936c..6c174b0ba 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -314,7 +314,7 @@ fail: * * We could queue this and wait for it to come back, but this is simple. */ -static void hout_subd_died(struct htlc_out *hout) +static void destroy_hout_subd_died(struct htlc_out *hout) { log_debug(hout->key.channel->log, "Failing HTLC %"PRIu64" due to peer death", @@ -355,7 +355,7 @@ static void rcvd_htlc_reply(struct subd *subd, const u8 *msg, const int *fds, local_fail_htlc(hout->in, failure_code, hout->key.channel->scid); /* Prevent hout from being failed twice. */ - tal_del_destructor(hout, hout_subd_died); + tal_del_destructor(hout, destroy_hout_subd_died); tal_free(hout); return; } @@ -400,7 +400,7 @@ enum onion_type send_htlc_out(struct channel *out, u64 amount, u32 cltv, /* Make peer's daemon own it, catch if it dies. */ hout = new_htlc_out(out->owner, out, amount, cltv, payment_hash, onion_routing_packet, in); - tal_add_destructor(hout, hout_subd_died); + tal_add_destructor(hout, destroy_hout_subd_died); msg = towire_channel_offer_htlc(out, amount, cltv, payment_hash, onion_routing_packet); @@ -894,7 +894,7 @@ static bool update_out_htlc(struct channel *channel, /* First transition into commitment; now it outlives peer. */ if (newstate == SENT_ADD_COMMIT) { - tal_del_destructor(hout, hout_subd_died); + tal_del_destructor(hout, destroy_hout_subd_died); tal_steal(ld, hout); } else if (newstate == RCVD_REMOVE_ACK_REVOCATION) { diff --git a/lightningd/subd.c b/lightningd/subd.c index fdc2b3b35..b0af1def9 100644 --- a/lightningd/subd.c +++ b/lightningd/subd.c @@ -48,7 +48,7 @@ struct subd_req { void *disabler; }; -static void free_subd_req(struct subd_req *sr) +static void destroy_subd_req(struct subd_req *sr) { list_del(&sr->list); /* Don't disable once we're freed! */ @@ -98,7 +98,7 @@ static void add_req(const tal_t *ctx, /* Keep in FIFO order: we sent in order, so replies will be too. */ list_add_tail(&sd->reqs, &sr->list); - tal_add_destructor(sr, free_subd_req); + tal_add_destructor(sr, destroy_subd_req); } /* Caller must free. */ diff --git a/wallet/db.c b/wallet/db.c index c651080b6..49fa4f92e 100644 --- a/wallet/db.c +++ b/wallet/db.c @@ -283,7 +283,10 @@ sqlite3_stmt *PRINTF_FMT(3, 4) return stmt; } -static void close_db(struct db *db) { sqlite3_close(db->sql); } +static void destroy_db(struct db *db) +{ + sqlite3_close(db->sql); +} void db_begin_transaction_(struct db *db, const char *location) { @@ -325,7 +328,7 @@ static struct db *db_open(const tal_t *ctx, char *filename) db = tal(ctx, struct db); db->filename = tal_dup_arr(db, char, filename, strlen(filename), 0); db->sql = sql; - tal_add_destructor(db, close_db); + tal_add_destructor(db, destroy_db); db->in_transaction = NULL; db_do_exec(__func__, db, "PRAGMA foreign_keys = ON;"); diff --git a/wallet/invoices.c b/wallet/invoices.c index b237c6de5..129230065 100644 --- a/wallet/invoices.c +++ b/wallet/invoices.c @@ -434,7 +434,7 @@ void invoices_resolve(struct invoices *invoices, } /* Called when an invoice waiter is destructed. */ -static void invoice_waiter_dtor(struct invoice_waiter *w) +static void destroy_invoice_waiter(struct invoice_waiter *w) { /* Already triggered. */ if (w->triggered) @@ -453,7 +453,7 @@ static void add_invoice_waiter(const tal_t *ctx, list_add_tail(waiters, &w->list); w->cb = cb; w->cbarg = cbarg; - tal_add_destructor(w, &invoice_waiter_dtor); + tal_add_destructor(w, &destroy_invoice_waiter); } diff --git a/wallet/wallet.c b/wallet/wallet.c index 361d87845..cb2397634 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -1327,7 +1327,7 @@ find_unstored_payment(struct wallet *wallet, const struct sha256 *payment_hash) return NULL; } -static void remove_unstored_payment(struct wallet_payment *payment) +static void destroy_unstored_payment(struct wallet_payment *payment) { list_del(&payment->list); } @@ -1337,7 +1337,7 @@ void wallet_payment_setup(struct wallet *wallet, struct wallet_payment *payment) assert(!find_unstored_payment(wallet, &payment->payment_hash)); list_add_tail(&wallet->unstored_payments, &payment->list); - tal_add_destructor(payment, remove_unstored_payment); + tal_add_destructor(payment, destroy_unstored_payment); } void wallet_payment_store(struct wallet *wallet,