]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Make vshCommandOptScaledInt() use vshCommandOpt()
authorAndrea Bolognani <abologna@redhat.com>
Tue, 2 Jun 2015 09:17:27 +0000 (11:17 +0200)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 2 Jun 2015 13:20:30 +0000 (09:20 -0400)
This aligns it to the other vshCommandOpt*() functions.

tools/virsh.c

index 55caa877016f2e237b77fce97c485ff2154ccd06..cd2bfef5a717d8cc3a1d9531a8ef59ac4d937534 100644 (file)
@@ -1804,16 +1804,16 @@ vshCommandOptScaledInt(const vshCmd *cmd, const char *name,
                        unsigned long long *value, int scale,
                        unsigned long long max)
 {
-    const char *str;
-    int ret;
+    vshCmdOpt *arg;
     char *end;
+    int ret;
 
-    ret = vshCommandOptString(cmd, name, &str);
-    if (ret <= 0)
+    if ((ret = vshCommandOpt(cmd, name, &arg, true)) <= 0)
         return ret;
-    if (virStrToLong_ullp(str, &end, 10, value) < 0 ||
+    if (virStrToLong_ullp(arg->data, &end, 10, value) < 0 ||
         virScaleInteger(value, end, scale, max) < 0)
         return -1;
+
     return 1;
 }