From 4452e3f3f16a6622a9018feedb7e249c3c1f14da Mon Sep 17 00:00:00 2001 From: practicalswift Date: Sun, 10 Dec 2017 14:18:44 +0100 Subject: [PATCH] Remove redundant code --- channeld/channel.c | 2 +- channeld/test/run-full_channel.c | 6 +----- lightningd/peer_control.c | 2 +- lightningd/test/run-commit_tx.c | 6 +----- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/channeld/channel.c b/channeld/channel.c index 2284eebb0..4d0cbbb70 100644 --- a/channeld/channel.c +++ b/channeld/channel.c @@ -2396,7 +2396,7 @@ static bool peer_write_pending(struct peer *peer) dev_sabotage_fd(PEER_FD); break; case DEV_DISCONNECT_DROPPKT: - msg = tal_free(msg); + tal_free(msg); peer->post_sabotage = true; peer->peer_outmsg = NULL; peer->peer_outoff = 0; diff --git a/channeld/test/run-full_channel.c b/channeld/test/run-full_channel.c index b50155992..5521d6e6a 100644 --- a/channeld/test/run-full_channel.c +++ b/channeld/test/run-full_channel.c @@ -189,15 +189,11 @@ static void tx_must_be_eq(const struct bitcoin_tx *a, { tal_t *tmpctx = tal_tmpctx(NULL); u8 *lina, *linb; - size_t i, len; + size_t i; lina = linearize_tx(tmpctx, a); linb = linearize_tx(tmpctx, b); - len = tal_len(lina); - if (tal_len(linb) < len) - len = tal_len(linb); - for (i = 0; i < tal_len(lina); i++) { if (i >= tal_len(linb)) errx(1, "Second tx is truncated:\n" diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 911bd736f..26b88068e 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -581,7 +581,7 @@ void peer_connected(struct lightningd *ld, const u8 *msg, /* Reconnect: discard old one. */ case OPENINGD: - peer = tal_free(peer); + tal_free(peer); goto return_to_gossipd; case ONCHAIND_CHEATED: diff --git a/lightningd/test/run-commit_tx.c b/lightningd/test/run-commit_tx.c index 45fa5e2eb..dfad78680 100644 --- a/lightningd/test/run-commit_tx.c +++ b/lightningd/test/run-commit_tx.c @@ -75,15 +75,11 @@ static void tx_must_be_eq(const struct bitcoin_tx *a, { tal_t *tmpctx = tal_tmpctx(NULL); u8 *lina, *linb; - size_t i, len; + size_t i; lina = linearize_tx(tmpctx, a); linb = linearize_tx(tmpctx, b); - len = tal_len(lina); - if (tal_len(linb) < len) - len = tal_len(linb); - for (i = 0; i < tal_len(lina); i++) { if (i >= tal_len(linb)) errx(1, "Second tx is truncated:\n"