From 0993f2f360458a0595e035a2e9f8338b83e72df1 Mon Sep 17 00:00:00 2001 From: Daniel Henrique Barboza Date: Mon, 16 Nov 2020 17:40:17 -0300 Subject: [PATCH] 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 --- src/conf/domain_conf.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) 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; } -- 2.47.3