[libvirt PATCH 07/10] virDomainDeviceVirtioSerialAddressParseXML: Use virXMLProp*

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/conf/device_conf.c | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index 5a98cd8c0f..587f966398 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -341,32 +341,19 @@ int
 virDomainDeviceVirtioSerialAddressParseXML(xmlNodePtr node,
                                            virDomainDeviceVirtioSerialAddress *addr)
 {
-    g_autofree char *controller = virXMLPropString(node, "controller");
-    g_autofree char *bus = virXMLPropString(node, "bus");
-    g_autofree char *port = virXMLPropString(node, "port");
-
     memset(addr, 0, sizeof(*addr));
 
-    if (controller &&
-        virStrToLong_uip(controller, NULL, 10, &addr->controller) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Cannot parse <address> 'controller' attribute"));
+    if (virXMLPropUInt(node, "controller", 10, VIR_XML_PROP_OPTIONAL,
+                       &addr->controller) < 0)
         return -1;
-    }
 
-    if (bus &&
-        virStrToLong_uip(bus, NULL, 10, &addr->bus) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Cannot parse <address> 'bus' attribute"));
+    if (virXMLPropUInt(node, "bus", 10, VIR_XML_PROP_OPTIONAL,
+                       &addr->bus) < 0)
         return -1;
-    }
 
-    if (port &&
-        virStrToLong_uip(port, NULL, 10, &addr->port) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Cannot parse <address> 'port' attribute"));
+    if (virXMLPropUInt(node, "port", 10, VIR_XML_PROP_OPTIONAL,
+                       &addr->port) < 0)
         return -1;
-    }
 
     return 0;
 }
-- 
2.26.2




[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