[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 04/16] qemu-option: parse_option_size(): use error_s
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PATCH 04/16] qemu-option: parse_option_size(): use error_set() |
Date: |
Mon, 21 May 2012 14:41:47 -0300 |
Signed-off-by: Luiz Capitulino <address@hidden>
---
qemu-option.c | 17 ++++++++---------
1 file 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();
}
--
1.7.9.2.384.g4a92a
- [Qemu-devel] [PATCH 08/16] qemu-option: introduce qemu_opt_set_err(), (continued)
- [Qemu-devel] [PATCH 08/16] qemu-option: introduce qemu_opt_set_err(), Luiz Capitulino, 2012/05/21
- [Qemu-devel] [PATCH 14/16] net: net_client_init(): use error_set(), Luiz Capitulino, 2012/05/21
- [Qemu-devel] [PATCH 01/16] qemu-option: qemu_opts_create(): use error_set(), Luiz Capitulino, 2012/05/21
- [Qemu-devel] [PATCH 06/16] qemu-option: qemu_opts_validate(): use error_set(), Luiz Capitulino, 2012/05/21
- [Qemu-devel] [PATCH 11/16] qemu-config: find_list(): use error_set(), Luiz Capitulino, 2012/05/21
- [Qemu-devel] [PATCH 09/16] qemu-option: qemu_opts_from_qdict(): use error_set(), Luiz Capitulino, 2012/05/21
- [Qemu-devel] [PATCH 07/16] qemu-option: opt_set(): use error_set(), Luiz Capitulino, 2012/05/21
- Re: [Qemu-devel] [PATCH qmp-next v5 00/16]: qapi: convert netdev_add & netdev_del, Laszlo Ersek, 2012/05/21
- [Qemu-devel] [PATCH 05/16] qemu-option: qemu_opt_parse(): use error_set(), Luiz Capitulino, 2012/05/21
- [Qemu-devel] [PATCH 03/16] qemu-option: parse_option_bool(): use error_set(), Luiz Capitulino, 2012/05/21
- [Qemu-devel] [PATCH 04/16] qemu-option: parse_option_size(): use error_set(),
Luiz Capitulino <=
- [Qemu-devel] [PATCH 12/16] qemu-config: introduce qemu_find_opts_err(), Luiz Capitulino, 2012/05/21
- [Qemu-devel] [PATCH 02/16] qemu-option: parse_option_number(): use error_set(), Luiz Capitulino, 2012/05/21
- [Qemu-devel] [PATCH 16/16] qapi: convert netdev_del, Luiz Capitulino, 2012/05/21
- [Qemu-devel] [PATCH 10/16] qerror: introduce QERR_INVALID_OPTION_GROUP, Luiz Capitulino, 2012/05/21
- [Qemu-devel] [PATCH 15/16] qapi: convert netdev_add, Luiz Capitulino, 2012/05/21
- [Qemu-devel] [PATCH 13/16] net: purge the monitor object from all init functions, Luiz Capitulino, 2012/05/21