aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2012-03-21 15:03:45 -0300
committerLuiz Capitulino <lcapitulino@redhat.com>2012-06-04 13:49:34 -0300
commitec7b2ccb4a6366784ff2c793b43b4c0940909f44 (patch)
tree9b186ae32f65223d14a35a9c045759ca1f0b1895
parentcf62adfabf29c0b7833a5306023cab5c0bc3b6d5 (diff)
downloadqemu-ec7b2ccb4a6366784ff2c793b43b4c0940909f44.zip
qemu-ec7b2ccb4a6366784ff2c793b43b4c0940909f44.tar.gz
qemu-ec7b2ccb4a6366784ff2c793b43b4c0940909f44.tar.bz2
qemu-option: parse_option_size(): use error_set()
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-By: Laszlo Ersek <lersek@redhat.com>
-rw-r--r--qemu-option.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/qemu-option.c b/qemu-option.c
index b5da116..42bb685 100644
--- a/qemu-option.c
+++ b/qemu-option.c
@@ -203,7 +203,8 @@ static void parse_option_number(const char *name, const char *value,
}
}
-static int parse_option_size(const char *name, const char *value, uint64_t *ret)
+static void parse_option_size(const char *name, const char *value,
+ uint64_t *ret, Error **errp)
{
char *postfix;
double sizef;
@@ -229,16 +230,14 @@ static int parse_option_size(const char *name, const char *value, uint64_t *ret)
*ret = (uint64_t) sizef;
break;
default:
- qerror_report(QERR_INVALID_PARAMETER_VALUE, name, "a size");
+ error_set(errp, QERR_INVALID_PARAMETER_VALUE, name, "a size");
error_printf_unless_qmp("You may use k, M, G or T suffixes for "
"kilobytes, megabytes, gigabytes and terabytes.\n");
- return -1;
+ return;
}
} else {
- qerror_report(QERR_INVALID_PARAMETER_VALUE, name, "a size");
- return -1;
+ error_set(errp, QERR_INVALID_PARAMETER_VALUE, name, "a size");
}
- return 0;
}
/*
@@ -290,8 +289,7 @@ int set_option_parameter(QEMUOptionParameter *list, const char *name,
break;
case OPT_SIZE:
- if (parse_option_size(name, value, &list->value.n) == -1)
- return -1;
+ parse_option_size(name, value, &list->value.n, &local_err);
break;
default:
@@ -602,7 +600,8 @@ static int qemu_opt_parse(QemuOpt *opt)
&local_err);
break;
case QEMU_OPT_SIZE:
- return parse_option_size(opt->name, opt->str, &opt->value.uint);
+ parse_option_size(opt->name, opt->str, &opt->value.uint, &local_err);
+ break;
default:
abort();
}