#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
+#include <sys/select.h>
#include <errno.h>
#include "xcb.h"
reader_list **prev_reader;
for(prev_reader = &c->in.readers; *prev_reader && (*prev_reader)->request <= request; prev_reader = &(*prev_reader)->next)
- if((*prev_reader)->request == request)
- goto done; /* error */
-
+ /* empty */;
reader.request = request;
reader.data = &cond;
reader.next = *prev_reader;
if(!_xcb_conn_wait(c, &cond, 0, 0))
break;
-done:
for(prev_reader = &c->in.readers; *prev_reader && (*prev_reader)->request <= request; prev_reader = &(*prev_reader)->next)
if(*prev_reader == &reader)
{
int _xcb_in_expect_reply(XCBConnection *c, unsigned int request, enum workarounds workaround, int flags)
{
- if(workaround != WORKAROUND_NONE || flags != 0)
- {
- pending_reply *pend = malloc(sizeof(pending_reply));
- if(!pend)
- return 0;
- pend->request = request;
- pend->workaround = workaround;
- pend->flags = flags;
- pend->next = 0;
- *c->in.pending_replies_tail = pend;
- c->in.pending_replies_tail = &pend->next;
- }
+ pending_reply *pend = malloc(sizeof(pending_reply));
+ assert(workaround != WORKAROUND_NONE || flags != 0);
+ if(!pend)
+ return 0;
+ pend->request = request;
+ pend->workaround = workaround;
+ pend->flags = flags;
+ pend->next = 0;
+ *c->in.pending_replies_tail = pend;
+ c->in.pending_replies_tail = &pend->next;
return 1;
}