]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
domain_conf.c: modernize virDomainDefBootOrderPostParse()
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Mon, 16 Nov 2020 20:40:17 +0000 (17:40 -0300)
committerDaniel Henrique Barboza <danielhb413@gmail.com>
Tue, 1 Dec 2020 22:27:17 +0000 (19:27 -0300)
Use g_autoptr() with the hash and remove the 'cleanup' label.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
src/conf/domain_conf.c

index 4b80024f77f5d62ecc797a1694c5217d3fe095f1..5304d9e580b44cd20fb0022d99fab6823f03066f 100644 (file)
@@ -5810,20 +5810,19 @@ virDomainDefCollectBootOrder(virDomainDefPtr def G_GNUC_UNUSED,
 static int
 virDomainDefBootOrderPostParse(virDomainDefPtr def)
 {
-    GHashTable *bootHash = NULL;
-    int ret = -1;
+    g_autoptr(GHashTable) bootHash = NULL;
 
     if (!(bootHash = virHashNew(NULL)))
-        goto cleanup;
+        return -1;
 
     if (virDomainDeviceInfoIterate(def, virDomainDefCollectBootOrder, bootHash) < 0)
-        goto cleanup;
+        return -1;
 
     if (def->os.nBootDevs > 0 && virHashSize(bootHash) > 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("per-device boot elements cannot be used"
                          " together with os/boot elements"));
-        goto cleanup;
+        return -1;
     }
 
     if (def->os.nBootDevs == 0 && virHashSize(bootHash) == 0) {
@@ -5831,11 +5830,7 @@ virDomainDefBootOrderPostParse(virDomainDefPtr def)
         def->os.bootDevs[0] = VIR_DOMAIN_BOOT_DISK;
     }
 
-    ret = 0;
-
- cleanup:
-    virHashFree(bootHash);
-    return ret;
+    return 0;
 }