[Xcb-commit] xcbdpyinfo.c xcbrandr.c xcbxf86dri.c xcbxvinfo.c

Jamey Sharp jamey at kemper.freedesktop.org
Mon Nov 20 15:59:55 PST 2006


 xcbdpyinfo.c |    2 +-
 xcbrandr.c   |    2 +-
 xcbxf86dri.c |    2 +-
 xcbxvinfo.c  |    3 ++-
 4 files changed, 5 insertions(+), 4 deletions(-)

New commits:
diff-tree b649faee831f4291fee41b2d90acb319f6bc8cba (from e6b69e8c29469dff4ef0ad4a2bccab63efa6af4f)
Author: Jamey Sharp <jamey at minilop.net>
Date:   Mon Nov 20 15:59:39 2006 -0800

    Update connection-failed handling to check for error objects instead of null.
    
    In essence, replace 'if(!c)' with 'if(xcb_connection_has_error(c))'.

diff --git a/xcbdpyinfo.c b/xcbdpyinfo.c
index ae4b574..beaa144 100644
--- a/xcbdpyinfo.c
+++ b/xcbdpyinfo.c
@@ -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);
diff --git a/xcbrandr.c b/xcbrandr.c
index 65d0bdc..9a341e9 100644
--- a/xcbrandr.c
+++ b/xcbrandr.c
@@ -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);
   }
diff --git a/xcbxf86dri.c b/xcbxf86dri.c
index 435b3a3..ea26faf 100644
--- a/xcbxf86dri.c
+++ b/xcbxf86dri.c
@@ -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;
diff --git a/xcbxvinfo.c b/xcbxvinfo.c
index 95743cf..631f7f9 100644
--- a/xcbxvinfo.c
+++ b/xcbxvinfo.c
@@ -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);


More information about the xcb-commit mailing list