From 48b7c33cc7fb46af398b7e0aa3d50f05d2f1321b Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 15 Jul 2020 12:01:39 +0200 Subject: [PATCH] qemuDomainDiskBackingStoreGetName: Eliminate temp variable We can return the formatted string directly. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_domain.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 6627a3c6b9..131c297a9d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11633,14 +11633,10 @@ char * qemuDomainDiskBackingStoreGetName(virDomainDiskDefPtr disk, unsigned int idx) { - char *ret = NULL; - if (idx) - ret = g_strdup_printf("%s[%d]", disk->dst, idx); - else - ret = g_strdup(disk->dst); + return g_strdup_printf("%s[%d]", disk->dst, idx); - return ret; + return g_strdup(disk->dst); }