[PATCH] Simplify virDomainParseMemory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Do not store the return value of virDomainParseScaledValue,
it was overwritten anyway.

Delete the cleanup label, there is nothing to clean up.
---
 src/conf/domain_conf.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1ea74a6..f663969 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7547,28 +7547,22 @@ virDomainParseMemory(const char *xpath,
                      bool required,
                      bool capped)
 {
-    int ret = -1;
     unsigned long long bytes, max;
 
     max = virMemoryMaxValue(capped);
 
-    ret = virDomainParseScaledValue(xpath, units_xpath, ctxt,
-                                    &bytes, 1024, max, required);
-    if (ret < 0)
-        goto cleanup;
+    if (virDomainParseScaledValue(xpath, units_xpath, ctxt,
+                                  &bytes, 1024, max, required) < 0)
+        return -1;
 
     /* Yes, we really do use kibibytes for our internal sizing.  */
     *mem = VIR_DIV_UP(bytes, 1024);
 
     if (*mem >= VIR_DIV_UP(max, 1024)) {
         virReportError(VIR_ERR_OVERFLOW, "%s", _("size value too large"));
-        ret = -1;
-        goto cleanup;
+        return -1;
     }
-
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }
 
 
-- 
2.4.10

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]