]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: interface: Preparation for g_auto
authorTim Wiederhake <twiederh@redhat.com>
Tue, 11 Jan 2022 16:54:56 +0000 (17:54 +0100)
committerTim Wiederhake <twiederh@redhat.com>
Fri, 14 Jan 2022 14:38:49 +0000 (15:38 +0100)
These changes make the g_auto-ification in the next commit clearer.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/interface_conf.c

index 150616bda907b2b3844a0f51193dbfc74fa1caf5..cbe6aad957b89ae0c21a212825d239bc388c50e8 100644 (file)
@@ -453,14 +453,12 @@ virInterfaceDefParseIfAdressing(virInterfaceDef *def,
         }
         proto->family = tmp;
         if (STREQ(tmp, "ipv4")) {
-            ret = virInterfaceDefParseProtoIPv4(proto, ctxt);
-            if (ret != 0) {
+            if (virInterfaceDefParseProtoIPv4(proto, ctxt) != 0) {
                 virInterfaceProtocolDefFree(proto);
                 goto error;
             }
         } else if (STREQ(tmp, "ipv6")) {
-            ret = virInterfaceDefParseProtoIPv6(proto, ctxt);
-            if (ret != 0) {
+            if (virInterfaceDefParseProtoIPv6(proto, ctxt) != 0) {
                 virInterfaceProtocolDefFree(proto);
                 goto error;
             }
@@ -741,10 +739,12 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt,
     }
 
     switch (type) {
-        case VIR_INTERFACE_TYPE_ETHERNET:
-            if ((tmp = virXPathString("string(./mac/@address)", ctxt)))
-                def->mac = tmp;
+        case VIR_INTERFACE_TYPE_ETHERNET: {
+            char *mac = virXPathString("string(./mac/@address)", ctxt);
+            if (mac != NULL)
+                def->mac = mac;
             break;
+        }
         case VIR_INTERFACE_TYPE_BRIDGE: {
             xmlNodePtr bridge;