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

[RFCv2 24/46] conf: Generate format functions for virDomainGraphicsSDLDef



Signed-off-by: Shi Lei <shi_lei massclouds com>
---
 src/conf/domain_conf.c | 20 +++++---------------
 src/conf/domain_conf.h |  2 +-
 2 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c1f8847..544b984 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -28266,27 +28266,17 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
         break;
 
     case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
-        if (def->data.sdl.display)
-            virBufferEscapeString(buf, " display='%s'",
-                                  def->data.sdl.display);
-
-        if (def->data.sdl.xauth)
-            virBufferEscapeString(buf, " xauth='%s'",
-                                  def->data.sdl.xauth);
-        if (def->data.sdl.fullscreen)
-            virBufferAddLit(buf, " fullscreen='yes'");
+        if (virDomainGraphicsSDLDefFormatAttr(buf, &def->data.sdl, def, NULL) < 0)
+            return -1;
 
-        if (!children && def->data.sdl.gl != VIR_TRISTATE_BOOL_ABSENT) {
+        if (!children && virDomainGraphicsSDLDefCheckElem(&def->data.sdl, def, NULL)) {
             virBufferAddLit(buf, ">\n");
             virBufferAdjustIndent(buf, 2);
             children = true;
         }
 
-        if (def->data.sdl.gl != VIR_TRISTATE_BOOL_ABSENT) {
-            virBufferAsprintf(buf, "<gl enable='%s'",
-                              virTristateBoolTypeToString(def->data.sdl.gl));
-            virBufferAddLit(buf, "/>\n");
-        }
+        if (virDomainGraphicsSDLDefFormatElem(buf, &def->data.sdl, def, NULL) < 0)
+            return -1;
 
         break;
 
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 13d2d4f..e64a284 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1672,7 +1672,7 @@ struct _virDomainGraphicsListenDef {
     bool autoGenerated;
 };
 
-struct _virDomainGraphicsSDLDef {   /* genparse */
+struct _virDomainGraphicsSDLDef {   /* genparse, genformat:separate */
     char *display;                  /* xmlattr */
     char *xauth;                    /* xmlattr */
     bool fullscreen;                /* xmlattr */
-- 
2.25.1



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