[libvirt PATCH 10/14] virInterfaceDefParseProtoIPv4: Simplify and cleanup

Tim Wiederhake twiederh at redhat.com
Wed Jan 12 13:10:11 UTC 2022


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/conf/interface_conf.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index bfeb69e664..c41eecac29 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -266,10 +266,8 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDef *def,
     g_autofree xmlNodePtr *ipNodes = NULL;
     int nipNodes;
     size_t i;
-    char *tmp;
 
-    tmp = virXPathString("string(./route[1]/@gateway)", ctxt);
-    def->gateway = tmp;
+    def->gateway = virXPathString("string(./route[1]/@gateway)", ctxt);
 
     dhcp = virXPathNode("./dhcp", ctxt);
     if (dhcp != NULL) {
@@ -287,10 +285,7 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDef *def,
 
     def->nips = 0;
     for (i = 0; i < nipNodes; i++) {
-
-        virInterfaceIPDef *ip;
-
-        ip = g_new0(virInterfaceIPDef, 1);
+        virInterfaceIPDef *ip = g_new0(virInterfaceIPDef, 1);
 
         if (virInterfaceDefParseIP(ip, ipNodes[i]) < 0) {
             virInterfaceIPDefFree(ip);
-- 
2.31.1




More information about the libvir-list mailing list