[PATCH 07/37] virDomainNetDefParseXML: Use virXMLPropEnumDefault for parsing 'def->type'

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

 



Replace ad-hoc logic that fills the default by use of the proper helper
function.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 621b1df6c8..745a7e428c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9002,13 +9002,10 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,

     ctxt->node = node;

-    if ((rv = virXMLPropEnum(node, "type", virDomainNetTypeFromString,
-                             VIR_XML_PROP_NONE, &def->type)) < 0)
+    if (virXMLPropEnumDefault(node, "type", virDomainNetTypeFromString,
+                              VIR_XML_PROP_NONE, &def->type, VIR_DOMAIN_NET_TYPE_USER) < 0)
         return NULL;

-    if (rv == 0)
-        def->type = VIR_DOMAIN_NET_TYPE_USER;
-
     if (virXMLPropTristateBool(node, "trustGuestRxFilters", VIR_XML_PROP_NONE,
                                &def->trustGuestRxFilters) < 0)
         return NULL;
-- 
2.37.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