[libvirt PATCH 10/16] domain_conf: graphics: extract DBus formatting to separate function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



virDomainGraphicsDefFormat function was way too long so split it into
separate functions for each graphics type.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 83dccd87f1..81068570a0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -26573,6 +26573,23 @@ virDomainGraphicsDefFormatEGLHeadless(virBuffer *childBuf,
                                  def->data.egl_headless.rendernode);
 }
 
+static void
+virDomainGraphicsDefFormatDBus(virBuffer *attrBuf,
+                               virBuffer *childBuf,
+                               virDomainGraphicsDef *def)
+{
+    if (def->data.dbus.p2p)
+        virBufferAddLit(attrBuf, " p2p='yes'");
+
+    if (def->data.dbus.address)
+        virBufferAsprintf(attrBuf, " address='%s'", def->data.dbus.address);
+
+    virDomainGraphicsDefFormatGL(childBuf, def->data.dbus.gl,
+                                 def->data.dbus.rendernode);
+
+    virDomainGraphicsDefFormatAudio(childBuf, def->data.dbus.audioId);
+}
+
 static int
 virDomainGraphicsDefFormat(virBuffer *buf,
                            virDomainGraphicsDef *def,
@@ -26619,18 +26636,9 @@ virDomainGraphicsDefFormat(virBuffer *buf,
         break;
 
     case VIR_DOMAIN_GRAPHICS_TYPE_DBUS:
-        if (def->data.dbus.p2p)
-            virBufferAddLit(&attrBuf, " p2p='yes'");
-        if (def->data.dbus.address)
-            virBufferAsprintf(&attrBuf, " address='%s'",
-                              def->data.dbus.address);
-
-        virDomainGraphicsDefFormatGL(&childBuf, def->data.dbus.gl,
-                                     def->data.dbus.rendernode);
-
-        virDomainGraphicsDefFormatAudio(&childBuf, def->data.dbus.audioId);
-
+        virDomainGraphicsDefFormatDBus(&attrBuf, &childBuf, def);
         break;
+
     case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
         break;
     }
-- 
2.48.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux