From 2c356fde55ce09f7623e13b109cb3301889b1b8f Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 22 Jan 2016 06:41:45 +1030 Subject: [PATCH] state: remove unnecessary set_errpkt() helper. This was needed when idata->pkt wasn't a tal pointer, for testing, but now it always is anyway. Signed-off-by: Rusty Russell --- state.c | 4 ++-- test/test_state_coverage.c | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/state.c b/state.c index 60e8ad3a4..a440d00bb 100644 --- a/state.c +++ b/state.c @@ -547,7 +547,7 @@ struct state_effect *state(const tal_t *ctx, return next_state(ctx, effect, STATE_CLOSE_WAIT_CLOSE); } else if (input_is(input, PKT_ERROR)) { add_effect(&effect, in_error, - set_errpkt(ctx, idata->pkt)); + tal_steal(ctx, idata->pkt)); goto start_unilateral_close_already_closing; } else if (input_is_pkt(input)) { /* We ignore all other packets while closing. */ @@ -845,7 +845,7 @@ unexpected_pkt: */ /* Don't reply to an error with an error. */ if (input_is(input, PKT_ERROR)) { - add_effect(&effect, in_error, set_errpkt(ctx, idata->pkt)); + add_effect(&effect, in_error, tal_steal(ctx, idata->pkt)); goto start_unilateral_close; } err = unexpected_pkt(ctx, input); diff --git a/test/test_state_coverage.c b/test/test_state_coverage.c index 9a65c5b8d..61e17b008 100644 --- a/test/test_state_coverage.c +++ b/test/test_state_coverage.c @@ -482,12 +482,6 @@ static enum state_input input_by_name(const char *name) abort(); } -/* We don't bother with lifetime issues */ -static Pkt *set_errpkt(const tal_t *ctx, const Pkt *pkt) -{ - return (Pkt *)pkt; -} - static Pkt *new_pkt(const tal_t *ctx, enum state_input i) { return (Pkt *)input_name(i);