In essence, replace 'if(!c)' with 'if(xcb_connection_has_error(c))'.
int screen;
c = xcb_connect(0, &screen);
- if(!c)
+ if(xcb_connection_has_error(c))
{
fputs("Connect failed.\n", stderr);
exit(1);
exit (1);
}
c = xcb_connect(display_name, &screen);
- if (!c) {
+ if (xcb_connection_has_error(c)) {
fprintf (stderr, "Can't open display %s\n", display_name);
exit (1);
}
xcb_xf86dri_query_direct_rendering_capable_reply_t *qdr;
xcb_connection_t *c = xcb_connect(NULL, &screen);
- if(!c)
+ if(xcb_connection_has_error(c))
{
fprintf(stderr, "Error establishing connection to X server.");
return 1;
}
if (!display_name) display_name = getenv("DISPLAY");
- if (!(c = xcb_connect(display_name, &scrn)))
+ c = xcb_connect(display_name, &scrn);
+ if (xcb_connection_has_error(c))
{
fprintf(stderr, "xcbxvinfo: Unable to open display %s\n", display_name);
exit(1);