From a5af4b170139a6e6a0dae7535fb00278ed4639c6 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 14 Oct 2013 21:28:36 +1030 Subject: [PATCH 1/1] ccan/io: remove IO_IDLE state. Use a NULL io pointer instead to indicate an idle connection. Signed-off-by: Rusty Russell --- ccan/io/io.c | 5 +++-- ccan/io/io.h | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ccan/io/io.c b/ccan/io/io.c index bd45630a..ef79e410 100644 --- a/ccan/io/io.c +++ b/ccan/io/io.c @@ -230,7 +230,8 @@ struct io_plan io_idle(void) struct io_plan plan; plan.pollflag = 0; - plan.state = IO_IDLE; + plan.state = IO_IO; + plan.io = NULL; return plan; } @@ -241,7 +242,7 @@ void io_wake(struct io_conn *conn, struct io_plan plan) /* It might have finished, but we haven't called its finish() yet. */ if (conn->plan.state == IO_FINISHED) return; - assert(conn->plan.state == IO_IDLE); + assert(!conn->plan.io); conn->plan = plan; backend_wakeup(conn); } diff --git a/ccan/io/io.h b/ccan/io/io.h index 5bbe42a4..fb6feb4d 100644 --- a/ccan/io/io.h +++ b/ccan/io/io.h @@ -36,7 +36,6 @@ enum io_result { enum io_state { IO_IO, - IO_IDLE, IO_FINISHED }; -- 2.39.2