diff options
Diffstat (limited to 'src/pulse/client-conf-x11.c')
-rw-r--r-- | src/pulse/client-conf-x11.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/pulse/client-conf-x11.c b/src/pulse/client-conf-x11.c index 8cedc48b..393a7cd3 100644 --- a/src/pulse/client-conf-x11.c +++ b/src/pulse/client-conf-x11.c @@ -1,8 +1,8 @@ -/* $Id$ */ - /*** This file is part of PulseAudio. + Copyright 2004-2006 Lennart Poettering + PulseAudio is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, @@ -24,7 +24,6 @@ #endif #include <string.h> -#include <assert.h> #include <X11/Xlib.h> #include <X11/Xatom.h> @@ -34,6 +33,7 @@ #include <pulsecore/x11prop.h> #include <pulsecore/log.h> #include <pulsecore/core-util.h> +#include <pulsecore/macro.h> #include "client-conf-x11.h" @@ -42,9 +42,14 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) { int ret = -1; char t[1024]; - if (!dname && !getenv("DISPLAY")) + pa_assert(c); + + if (!dname && !(dname = getenv("DISPLAY"))) goto finish; - + + if (*dname == 0) + goto finish; + if (!(d = XOpenDisplay(dname))) { pa_log("XOpenDisplay() failed"); goto finish; @@ -73,10 +78,10 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) { goto finish; } - assert(sizeof(cookie) == sizeof(c->cookie)); + pa_assert(sizeof(cookie) == sizeof(c->cookie)); memcpy(c->cookie, cookie, sizeof(cookie)); - c->cookie_valid = 1; + c->cookie_valid = TRUE; pa_xfree(c->cookie_file); c->cookie_file = NULL; @@ -89,5 +94,5 @@ finish: XCloseDisplay(d); return ret; - + } |