X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fio%2Fio_plan.h;fp=ccan%2Fio%2Fio_plan.h;h=1d503133b6ddb24f4f50cb2e4d12c4fb3e9732d3;hp=1781856ea6f8e11a75cf54e11b2f79e848516c39;hb=a77ce0e968469c31c3c41efde85d77e6d5eac011;hpb=a0ab8f12ebd40760544a25e521e06c931f19fa5c diff --git a/ccan/io/io_plan.h b/ccan/io/io_plan.h index 1781856e..1d503133 100644 --- a/ccan/io/io_plan.h +++ b/ccan/io/io_plan.h @@ -35,22 +35,24 @@ enum io_direction { * io_set_plan() when you've initialized it. * * Example: + * #include + * * // Simple helper to read a single char. * static int do_readchar(int fd, struct io_plan_arg *arg) * { * return read(fd, arg->u1.cp, 1) <= 0 ? -1 : 1; * } * - * struct io_plan *io_read_char_(struct io_conn *conn, char *in, + * static struct io_plan *io_read_char_(struct io_conn *conn, char *in, * struct io_plan *(*next)(struct io_conn*,void*), - * void *arg) + * void *next_arg) * { - * struct io_plan_arg *arg = io_get_plan_arg(conn, IO_IN); + * struct io_plan_arg *arg = io_plan_arg(conn, IO_IN); * * // Store information we need in the plan unions u1 and u2. * arg->u1.cp = in; * - * return io_set_plan(conn, IO_IN, do_readchar, next, arg); + * return io_set_plan(conn, IO_IN, do_readchar, next, next_arg); * } */ struct io_plan_arg *io_plan_arg(struct io_conn *conn, enum io_direction dir);