From b649faee831f4291fee41b2d90acb319f6bc8cba Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Mon, 20 Nov 2006 15:59:39 -0800 Subject: [PATCH] Update connection-failed handling to check for error objects instead of null. In essence, replace 'if(!c)' with 'if(xcb_connection_has_error(c))'. --- xcbdpyinfo.c | 2 +- xcbrandr.c | 2 +- xcbxf86dri.c | 2 +- xcbxvinfo.c | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) 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); -- 2.34.1