Lines Matching refs:io
14 struct io {
29 static inline void io__init(struct io *io, int fd,
32 io->fd = fd;
33 io->buf_len = buf_len;
34 io->buf = buf;
35 io->end = buf;
36 io->data = buf;
37 io->eof = false;
40 /* Reads one character from the "io" file with similar semantics to fgetc. */
41 static inline int io__get_char(struct io *io)
43 char *ptr = io->data;
45 if (io->eof)
48 if (ptr == io->end) {
49 ssize_t n = read(io->fd, io->buf, io->buf_len);
52 io->eof = true;
55 ptr = &io->buf[0];
56 io->end = &io->buf[n];
58 io->data = ptr + 1;
63 * first character isn't hexadecimal returns -2, io->eof returns -1, otherwise
67 static inline int io__get_hex(struct io *io, __u64 *hex)
73 int ch = io__get_char(io);
92 * isn't a decimal returns -2, io->eof returns -1, otherwise returns the
96 static inline int io__get_dec(struct io *io, __u64 *dec)
102 int ch = io__get_char(io);