]> git.ozlabs.org Git - ccan/commitdiff
ccan/io: remove IO_IDLE state.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 14 Oct 2013 10:58:36 +0000 (21:28 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 14 Oct 2013 10:58:36 +0000 (21:28 +1030)
Use a NULL io pointer instead to indicate an idle connection.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/io/io.c
ccan/io/io.h

index bd45630a8c9168406a7088f1f12bcfed7f524f54..ef79e410217a8b76a4751112d8f0ac2e1c992475 100644 (file)
@@ -230,7 +230,8 @@ struct io_plan io_idle(void)
        struct io_plan plan;
 
        plan.pollflag = 0;
        struct io_plan plan;
 
        plan.pollflag = 0;
-       plan.state = IO_IDLE;
+       plan.state = IO_IO;
+       plan.io = NULL;
 
        return plan;
 }
 
        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;
        /* 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);
 }
        conn->plan = plan;
        backend_wakeup(conn);
 }
index 5bbe42a4ab38648d826bc08fce9f137f7b97e00c..fb6feb4d0b873e058800a634e7843d77ea1f7964 100644 (file)
@@ -36,7 +36,6 @@ enum io_result {
 
 enum io_state {
        IO_IO,
 
 enum io_state {
        IO_IO,
-       IO_IDLE,
        IO_FINISHED
 };
 
        IO_FINISHED
 };