[PATCH 10/13] virDomainSnapshotAlignDisks: remove unnecessary 'tmp' variable

Peter Krempa posted 13 patches 4 years, 2 months ago
[PATCH 10/13] virDomainSnapshotAlignDisks: remove unnecessary 'tmp' variable
Posted by Peter Krempa 4 years, 2 months ago
The converted string is used exactly once so we can call the conversion
without storing the result in a variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/conf/snapshot_conf.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index aeebe2fb33..10eb584a1c 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -709,12 +709,10 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr snapdef,
                    snapdisk->snapshot != default_snapshot &&
                    !(snapdisk->snapshot == VIR_DOMAIN_SNAPSHOT_LOCATION_NONE &&
                      disk_snapshot == VIR_DOMAIN_SNAPSHOT_LOCATION_NONE)) {
-            const char *tmp;
-
-            tmp = virDomainSnapshotLocationTypeToString(default_snapshot);
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("disk '%s' must use snapshot mode '%s'"),
-                           snapdisk->name, tmp);
+                           snapdisk->name,
+                           virDomainSnapshotLocationTypeToString(default_snapshot));
             return -1;
         }
         if (snapdisk->src->path &&
-- 
2.26.2

Re: [PATCH 10/13] virDomainSnapshotAlignDisks: remove unnecessary 'tmp' variable
Posted by Ján Tomko 4 years, 2 months ago
On a Wednesday in 2020, Peter Krempa wrote:
>The converted string is used exactly once so we can call the conversion
>without storing the result in a variable.
>

I presume this was done to reduce line length, not to reuse it.

>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/conf/snapshot_conf.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano