]> xenbits.xensource.com Git - libvirt.git/commitdiff
Simplify virDomainParseMemory
authorJán Tomko <jtomko@redhat.com>
Fri, 29 Jan 2016 17:00:13 +0000 (18:00 +0100)
committerJán Tomko <jtomko@redhat.com>
Wed, 3 Feb 2016 12:22:43 +0000 (13:22 +0100)
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

index 6aef3f852801346768397f14198afb7adfb487cf..55e7ed959098efd332ec8c62b4d588472967665d 100644 (file)
@@ -7584,28 +7584,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;
 }