API/ABI change: XCBSendRequest returns the sequence number instead of using an out-parameter. Now 0 is a special sequence number indicating failure.
This commit is contained in:
parent
255c21b17f
commit
29f9fe0fc8
|
|
@ -615,7 +615,7 @@ authorization from the authors.
|
|||
<l>xcb_parts[<xsl:value-of select="3 + position() * 2"/>].iov_len = -xcb_parts[<xsl:value-of select="2 + position() * 2"/>].iov_len & 3;</l>
|
||||
</xsl:for-each>
|
||||
|
||||
<l>XCBSendRequest(c, &xcb_ret.sequence, <!--
|
||||
<l>xcb_ret.sequence = XCBSendRequest(c, <!--
|
||||
--><xsl:choose>
|
||||
<xsl:when test="@has-reply">XCB_REQUEST_CHECKED</xsl:when>
|
||||
<xsl:otherwise>0</xsl:otherwise>
|
||||
|
|
|
|||
|
|
@ -238,6 +238,10 @@ void *XCBWaitForReply(XCBConnection *c, unsigned int request, XCBGenericError **
|
|||
if(e)
|
||||
*e = 0;
|
||||
|
||||
/* If an error occurred when issuing the request, fail immediately. */
|
||||
if(!request)
|
||||
return 0;
|
||||
|
||||
pthread_mutex_lock(&c->iolock);
|
||||
|
||||
/* If this request has not been written yet, write it. */
|
||||
|
|
|
|||
|
|
@ -69,15 +69,14 @@ CARD32 XCBGetMaximumRequestLength(XCBConnection *c)
|
|||
return c->out.maximum_request_length;
|
||||
}
|
||||
|
||||
int XCBSendRequest(XCBConnection *c, unsigned int *request, int flags, struct iovec *vector, const XCBProtocolRequest *req)
|
||||
unsigned int XCBSendRequest(XCBConnection *c, int flags, struct iovec *vector, const XCBProtocolRequest *req)
|
||||
{
|
||||
int ret;
|
||||
unsigned int request;
|
||||
CARD32 prefix[2];
|
||||
int veclen = req->count;
|
||||
enum workarounds workaround = WORKAROUND_NONE;
|
||||
|
||||
assert(c != 0);
|
||||
assert(request != 0);
|
||||
assert(vector != 0);
|
||||
assert(req->count > 0);
|
||||
|
||||
|
|
@ -92,8 +91,8 @@ int XCBSendRequest(XCBConnection *c, unsigned int *request, int flags, struct io
|
|||
if(req->ext)
|
||||
{
|
||||
const XCBQueryExtensionRep *extension = XCBGetExtensionData(c, req->ext);
|
||||
/* TODO: better error handling here, please! */
|
||||
assert(extension && extension->present);
|
||||
if(!(extension && extension->present))
|
||||
return 0;
|
||||
((CARD8 *) vector[0].iov_base)[0] = extension->major_opcode;
|
||||
((CARD8 *) vector[0].iov_base)[1] = req->opcode;
|
||||
}
|
||||
|
|
@ -148,20 +147,22 @@ int XCBSendRequest(XCBConnection *c, unsigned int *request, int flags, struct io
|
|||
if(req->isvoid && !force_sequence_wrap(c))
|
||||
{
|
||||
pthread_mutex_unlock(&c->iolock);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* wait for other writing threads to get out of my way. */
|
||||
while(c->out.writing)
|
||||
pthread_cond_wait(&c->out.cond, &c->iolock);
|
||||
|
||||
*request = ++c->out.request;
|
||||
request = ++c->out.request;
|
||||
assert(request != 0);
|
||||
|
||||
_xcb_in_expect_reply(c, *request, workaround, flags);
|
||||
_xcb_in_expect_reply(c, request, workaround, flags);
|
||||
|
||||
ret = _xcb_out_write_block(c, vector, veclen);
|
||||
if(!_xcb_out_write_block(c, vector, veclen))
|
||||
request = 0;
|
||||
pthread_mutex_unlock(&c->iolock);
|
||||
return ret;
|
||||
return request;
|
||||
}
|
||||
|
||||
int XCBFlush(XCBConnection *c)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ enum XCBSendRequestFlags {
|
|||
XCB_REQUEST_RAW = 1 << 1
|
||||
};
|
||||
|
||||
int XCBSendRequest(XCBConnection *c, unsigned int *sequence, int flags, struct iovec *vector, const XCBProtocolRequest *request);
|
||||
unsigned int XCBSendRequest(XCBConnection *c, int flags, struct iovec *vector, const XCBProtocolRequest *request);
|
||||
|
||||
|
||||
/* xcb_in.c */
|
||||
|
|
|
|||
Loading…
Reference in New Issue