diff options
author | Jamey Sharp <jamey@minilop.net> | 2006-02-24 00:59:08 -0800 |
---|---|---|
committer | Jamey Sharp <jamey@minilop.net> | 2006-02-24 00:59:08 -0800 |
commit | e1c2777abac0479ebdf06f2005120d25fff53935 (patch) | |
tree | 5d82c327415bea9dfafe1a70758834cfc04eac3e | |
parent | 3f8d0bd5322749132626e8f203017b6da6448fd0 (diff) |
Coalesce readn into _xcb_in_read and simplify.
-rw-r--r-- | src/xcb_in.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/xcb_in.c b/src/xcb_in.c index 4a62a48..ead0178 100644 --- a/src/xcb_in.c +++ b/src/xcb_in.c @@ -69,14 +69,6 @@ static void wake_up_next_reader(XCBConnection *c) assert(pthreadret == 0); } -static int readn(const int fd, void *buf, const int buflen, int *count) -{ - int n = read(fd, ((char *) buf) + *count, buflen - *count); - if(n > 0) - *count += n; - return n; -} - static int read_packet(XCBConnection *c) { XCBGenericRep genrep; @@ -336,7 +328,9 @@ int _xcb_in_expect_reply(XCBConnection *c, unsigned int request, enum workaround int _xcb_in_read(XCBConnection *c) { - int n = readn(c->fd, c->in.queue, sizeof(c->in.queue), &c->in.queue_len); + int n = read(c->fd, c->in.queue + c->in.queue_len, sizeof(c->in.queue) - c->in.queue_len); + if(n > 0) + c->in.queue_len += n; while(read_packet(c)) /* empty */; return (n > 0) || (n < 0 && errno == EAGAIN); |