Uli Schlachter <psyc...@znc.in> writes: > For bikeshedding, I would call this xcb_special_event_filter_t, because this > is > not actually an event. Having said that, feel free to ignore me.
It's more of a 'xcb_special_event_queue_t', but I decided that I just didn't see the value in making the type name even longer... >> +xcb_special_event_t * >> +xcb_register_for_special_xge(xcb_connection_t *c, >> + uint8_t extension, >> + uint32_t eid, >> + uint32_t *stamp) >> +{ >> + xcb_special_event_t *se; > > > Add this, please: > > if(c->has_error) > return NULL; Right above the pthread_mutex_lock call. > Is there any reason why this cannot return NULL on "collisisions"? > > Oh and: Please check for calloc() failures. You want it to be an error to register multiple times? That seems reasonable: xcb_special_event_t * xcb_register_for_special_xge(xcb_connection_t *c, uint8_t extension, uint32_t eid, uint32_t *stamp) { xcb_special_event_t *se; if(c->has_error) return NULL; pthread_mutex_lock(&c->iolock); for (se = c->in.special_events; se; se = se->next) { if (se->extension == extension && se->eid == eid) { pthread_mutex_unlock(&c->iolock); return NULL; } } se = calloc(1, sizeof(xcb_special_event_t)); if (!se) { pthread_mutex_unlock(&c->iolock); return NULL; } se->extension = extension; se->eid = eid; se->events = NULL; se->events_tail = &se->events; se->stamp = stamp; pthread_cond_init(&se->special_event_cond, 0); se->next = c->in.special_events; c->in.special_events = se; pthread_mutex_unlock(&c->iolock); return se; } > >> +void >> +xcb_unregister_for_special_event(xcb_connection_t *c, >> + xcb_special_event_t *se) >> +{ >> + xcb_special_event_t *s, **prev; >> + struct event_list *events, *next; > > if(c->has_error) > return; done. -- keith.pack...@intel.com
pgpXo2lbYOJVq.pgp
Description: PGP signature
_______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel