From: Daniel Henrique Barboza Date: Mon, 16 Nov 2020 20:40:17 +0000 (-0300) Subject: domain_conf.c: modernize virDomainDefBootOrderPostParse() X-Git-Tag: v7.0.0-rc1~376 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0993f2f360458a0595e035a2e9f8338b83e72df1;p=thirdparty%2Flibvirt.git domain_conf.c: modernize virDomainDefBootOrderPostParse() Use g_autoptr() with the hash and remove the 'cleanup' label. Reviewed-by: Michal Privoznik Signed-off-by: Daniel Henrique Barboza --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4b80024f77..5304d9e580 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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; }