qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 6/8] qemu-img: img_create(): simplify


From: Luiz Capitulino
Subject: [Qemu-devel] [PATCH 6/8] qemu-img: img_create(): simplify
Date: Wed, 17 Oct 2012 16:35:54 -0300

Drop unneeded goto and ret variable.

Signed-off-by: Luiz Capitulino <address@hidden>
---
 qemu-img.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index dfde588..0634402 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -294,7 +294,7 @@ static int add_old_style_options(const char *fmt, 
QEMUOptionParameter *list,
 
 static int img_create(int argc, char **argv)
 {
-    int c, ret = 0;
+    int c;
     uint64_t img_size = -1;
     const char *fmt = "raw";
     const char *base_fmt = NULL;
@@ -352,15 +352,13 @@ static int img_create(int argc, char **argv)
             error_report("Invalid image size specified! You may use k, M, G or 
"
                   "T suffixes for ");
             error_report("kilobytes, megabytes, gigabytes and terabytes.");
-            ret = -1;
-            goto out;
+            return 1;
         }
         img_size = (uint64_t)sval;
     }
 
     if (options && is_help_option(options)) {
-        ret = print_block_option_help(filename, fmt);
-        goto out;
+        return print_block_option_help(filename, fmt);
     }
 
     bdrv_img_create(filename, fmt, base_filename, base_fmt,
@@ -368,8 +366,7 @@ static int img_create(int argc, char **argv)
     if (error_is_set(&local_err)) {
         fprintf(stderr, "qemu-img: %s\n", error_get_pretty(local_err));
         error_free(local_err);
-        ret = -1;
-        goto out;
+        return 1;
     }
 
     assert(params);
@@ -378,10 +375,6 @@ static int img_create(int argc, char **argv)
     free_option_parameters(params);
     puts("");
 
-out:
-    if (ret) {
-        return 1;
-    }
     return 0;
 }
 
-- 
1.7.12.315.g682ce8b




reply via email to

[Prev in Thread] Current Thread [Next in Thread]