]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virInterfaceDefParseProtoIPv6: Simplify and cleanup
authorTim Wiederhake <twiederh@redhat.com>
Wed, 12 Jan 2022 12:39:08 +0000 (13:39 +0100)
committerTim Wiederhake <twiederh@redhat.com>
Fri, 14 Jan 2022 14:38:50 +0000 (15:38 +0100)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/interface_conf.c

index 2723eec2ec59dae62224784d79ad8d1dac2691be..71da243f6a17b7e2cab390602c533361be78e6e4 100644 (file)
@@ -302,17 +302,14 @@ static int
 virInterfaceDefParseProtoIPv6(virInterfaceProtocolDef *def,
                               xmlXPathContextPtr ctxt)
 {
-    xmlNodePtr dhcp, autoconf;
+    xmlNodePtr dhcp;
     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);
 
-    autoconf = virXPathNode("./autoconf", ctxt);
-    if (autoconf != NULL)
+    if (virXPathNode("./autoconf", ctxt) != NULL)
         def->autoconf = 1;
 
     dhcp = virXPathNode("./dhcp", ctxt);
@@ -331,10 +328,7 @@ virInterfaceDefParseProtoIPv6(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);