Update connection-failed handling to check for error objects instead of null.
authorJamey Sharp <jamey@minilop.net>
Mon, 20 Nov 2006 23:59:39 +0000 (15:59 -0800)
committerJamey Sharp <jamey@minilop.net>
Mon, 20 Nov 2006 23:59:39 +0000 (15:59 -0800)
In essence, replace 'if(!c)' with 'if(xcb_connection_has_error(c))'.

xcbdpyinfo.c
xcbrandr.c
xcbxf86dri.c
xcbxvinfo.c

index ae4b574..beaa144 100644 (file)
@@ -19,7 +19,7 @@ int main(int argc, char **argv)
     int screen;
 
     c = xcb_connect(0, &screen);
-    if(!c)
+    if(xcb_connection_has_error(c))
     {
        fputs("Connect failed.\n", stderr);
        exit(1);
index 65d0bdc..9a341e9 100644 (file)
@@ -232,7 +232,7 @@ main (int argc, char **argv)
       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);
   }
index 435b3a3..ea26faf 100644 (file)
@@ -15,7 +15,7 @@ int main(int argc, char **argv)
     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;
index 95743cf..631f7f9 100644 (file)
@@ -72,7 +72,8 @@ int main(int argc, char *argv[])
     }
 
     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);