merge glitch-free branch back into trunk
[profile/ivi/pulseaudio.git] / src / pulse / client-conf-x11.c
index b5ac8d9..49df4b6 100644 (file)
@@ -26,7 +26,6 @@
 #endif
 
 #include <string.h>
-#include <assert.h>
 
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
@@ -36,6 +35,7 @@
 #include <pulsecore/x11prop.h>
 #include <pulsecore/log.h>
 #include <pulsecore/core-util.h>
+#include <pulsecore/macro.h>
 
 #include "client-conf-x11.h"
 
@@ -44,7 +44,12 @@ 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))) {
@@ -75,10 +80,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;