From: Rusty Russell Date: Mon, 14 Oct 2013 10:58:36 +0000 (+1030) Subject: ccan/io: remove IO_IDLE state. X-Git-Url: http://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=a5af4b170139a6e6a0dae7535fb00278ed4639c6;hp=f6f11f6b06bde2c1d5ce0f744998f07c6bce4546 ccan/io: remove IO_IDLE state. Use a NULL io pointer instead to indicate an idle connection. Signed-off-by: Rusty Russell --- 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 };