From 622b599c8fcf5d677f76ca03f3241a23dba58712 Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Thu, 2 Mar 2006 23:39:38 -0800 Subject: [PATCH] Tweak to previous API change: Require that spare iovecs fall before vector[0]. Leave vector in well-defined state. --- src/c-client.xsl | 18 +++++++++--------- src/xcb_out.c | 7 ++++--- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/c-client.xsl b/src/c-client.xsl index 568e46c..1e37ea9 100644 --- a/src/c-client.xsl +++ b/src/c-client.xsl @@ -596,30 +596,30 @@ authorization from the authors. mode="assign" /> - xcb_parts[0].iov_base = &xcb_out; - xcb_parts[0].iov_len = sizeof(xcb_out); - xcb_parts[1].iov_base = 0; - xcb_parts[1].iov_len = -xcb_parts[0].iov_len & 3; + xcb_parts[2].iov_base = &xcb_out; + xcb_parts[2].iov_len = sizeof(xcb_out); + xcb_parts[3].iov_base = 0; + xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; - xcb_parts[].iov_base = (void *) ; - xcb_parts[].iov_len = * sizeof( ) ; - xcb_parts[].iov_base = 0; - xcb_parts[].iov_len = -xcb_parts[].iov_len & 3; + xcb_parts[].iov_base = 0; + xcb_parts[].iov_len = -xcb_parts[].iov_len & 3; XCBSendRequest(c, &xcb_ret.sequence, XCB_REQUEST_CHECKED 0 - , xcb_parts, &xcb_req); + , xcb_parts + 2, &xcb_req); return xcb_ret; diff --git a/src/xcb_out.c b/src/xcb_out.c index 78ec8ca..b201565 100644 --- a/src/xcb_out.c +++ b/src/xcb_out.c @@ -126,8 +126,7 @@ int XCBSendRequest(XCBConnection *c, unsigned int *request, int flags, struct io ((CARD16 *) vector[0].iov_base)[1] = shortlen; if(!shortlen) { - memmove(vector + 1, vector, veclen++ * sizeof(*vector)); - ++veclen; + --vector, ++veclen; vector[0].iov_base = prefix; vector[0].iov_len = sizeof(prefix); prefix[0] = ((CARD32 *) vector[0].iov_base)[0]; @@ -237,12 +236,14 @@ int _xcb_out_write_block(XCBConnection *c, struct iovec *vector, size_t count) { memcpy(c->out.queue + c->out.queue_len, vector[0].iov_base, vector[0].iov_len); c->out.queue_len += vector[0].iov_len; + vector[0].iov_base = (char *) vector[0].iov_base + vector[0].iov_len; + vector[0].iov_len = 0; ++vector, --count; } if(!count) return 1; - memmove(vector + 1, vector, count++ * sizeof(struct iovec)); + --vector, ++count; vector[0].iov_base = c->out.queue; vector[0].iov_len = c->out.queue_len; c->out.queue_len = 0; -- 2.34.1