]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: event: Clean up VNC monitor handling
authorPeter Krempa <pkrempa@redhat.com>
Mon, 29 Jun 2015 15:03:14 +0000 (17:03 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 30 Jun 2015 11:50:52 +0000 (13:50 +0200)
Get rid of spice specific stuff from the handler func and save a few
lines by reflowing the conditions.

src/qemu/qemu_monitor_json.c

index 47953a805e3f12ed71b20bef22f6256a9c364c6b..f0cfc57674239310815b2ab33c86c08a1c5e8126 100644 (file)
@@ -638,40 +638,37 @@ qemuMonitorJSONHandleGraphicsVNC(qemuMonitorPtr mon,
         return;
     }
 
-    authScheme = virJSONValueObjectGetString(server, "auth");
-    if (!authScheme) {
+    if (!(authScheme = virJSONValueObjectGetString(server, "auth"))) {
         /* not all events are required to contain auth scheme */
-        VIR_DEBUG("missing auth scheme in graphics event");
+        VIR_DEBUG("missing auth scheme in VNC event");
         authScheme = "";
     }
 
-    localFamily = virJSONValueObjectGetString(server, "family");
-    if (!localFamily) {
-        VIR_WARN("missing local address family in graphics event");
+    if (!(localFamily = virJSONValueObjectGetString(server, "family"))) {
+        VIR_WARN("missing local address family in VNC event");
         return;
     }
-    localNode = virJSONValueObjectGetString(server, "host");
-    if (!localNode) {
-        VIR_WARN("missing local hostname in graphics event");
+    if (!(localNode = virJSONValueObjectGetString(server, "host"))) {
+        VIR_WARN("missing local hostname in VNC event");
+        return;
+    }
+    if (!(localService = virJSONValueObjectGetString(server, "service"))) {
+        VIR_WARN("missing local service in VNC event");
         return;
     }
-    localService = virJSONValueObjectGetString(server, "service");
-    if (!localService)
-        localService = ""; /* Spice has multiple ports, so this isn't provided */
 
-    remoteFamily = virJSONValueObjectGetString(client, "family");
-    if (!remoteFamily) {
-        VIR_WARN("missing remote address family in graphics event");
+    if (!(remoteFamily = virJSONValueObjectGetString(client, "family"))) {
+        VIR_WARN("missing remote address family in VNC event");
+        return;
+    }
+    if (!(remoteNode = virJSONValueObjectGetString(client, "host"))) {
+        VIR_WARN("missing remote hostname in VNC event");
         return;
     }
-    remoteNode = virJSONValueObjectGetString(client, "host");
-    if (!remoteNode) {
-        VIR_WARN("missing remote hostname in graphics event");
+    if (!(remoteService = virJSONValueObjectGetString(client, "service"))) {
+        VIR_WARN("missing remote service in VNC event");
         return;
     }
-    remoteService = virJSONValueObjectGetString(client, "service");
-    if (!remoteService)
-        remoteService = ""; /* Spice has multiple ports, so this isn't provided */
 
     saslUsername = virJSONValueObjectGetString(client, "sasl_username");
     x509dname = virJSONValueObjectGetString(client, "x509_dname");