]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
xenconfig: use local variable for graphics def
authorJim Fehlig <jfehlig@suse.com>
Thu, 23 Apr 2015 21:26:04 +0000 (15:26 -0600)
committerJim Fehlig <jfehlig@suse.com>
Mon, 18 May 2015 18:46:16 +0000 (12:46 -0600)
'graphics->' is a bit easier to read and type, and makes for
shorter lines than 'def->graphics[0]->'.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
src/xenconfig/xen_xl.c

index b12d3060d9d579ff05c327b55c5d0cd3224b1d3c..767ac014d96f6e7a50777b63577611767f453ae7 100644 (file)
@@ -667,9 +667,12 @@ static int
 xenFormatXLSpice(virConfPtr conf, virDomainDefPtr def)
 {
     const char *listenAddr = NULL;
+    virDomainGraphicsDefPtr graphics;
 
     if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
-        if (def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
+        graphics = def->graphics[0];
+
+        if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
             /* set others to false but may not be necessary */
             if (xenConfigSetInt(conf, "sdl", 0) < 0)
                 return -1;
@@ -681,37 +684,37 @@ xenFormatXLSpice(virConfPtr conf, virDomainDefPtr def)
                 return -1;
 
             if (xenConfigSetInt(conf, "spiceport",
-                                def->graphics[0]->data.spice.port) < 0)
+                                graphics->data.spice.port) < 0)
                 return -1;
 
             if (xenConfigSetInt(conf, "spicetls_port",
-                                def->graphics[0]->data.spice.tlsPort) < 0)
+                                graphics->data.spice.tlsPort) < 0)
                 return -1;
 
-            if (def->graphics[0]->data.spice.auth.passwd) {
+            if (graphics->data.spice.auth.passwd) {
                 if (xenConfigSetInt(conf, "spicedisable_ticketing", 1) < 0)
                     return -1;
 
-                if (def->graphics[0]->data.spice.auth.passwd &&
+                if (graphics->data.spice.auth.passwd &&
                     xenConfigSetString(conf, "spicepasswd",
-                                def->graphics[0]->data.spice.auth.passwd) < 0)
+                                graphics->data.spice.auth.passwd) < 0)
                     return -1;
             }
 
-            listenAddr = virDomainGraphicsListenGetAddress(def->graphics[0], 0);
+            listenAddr = virDomainGraphicsListenGetAddress(graphics, 0);
             if (listenAddr &&
                 xenConfigSetString(conf, "spicehost", listenAddr) < 0)
                 return -1;
 
             if (xenConfigSetInt(conf, "spiceagent_mouse",
-                                def->graphics[0]->data.spice.mousemode) < 0)
+                                graphics->data.spice.mousemode) < 0)
                 return -1;
 
-            if (def->graphics[0]->data.spice.copypaste) {
+            if (graphics->data.spice.copypaste) {
                 if (xenConfigSetInt(conf, "spicedvagent", 1) < 0)
                     return -1;
                 if (xenConfigSetInt(conf, "spice_clipboard_sharing",
-                                def->graphics[0]->data.spice.copypaste) < 0)
+                                graphics->data.spice.copypaste) < 0)
                 return -1;
             }
         }