mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
QemuOpts: Convert qemu_opt_set_bool() to Error, fix its use
Return the Error object instead of reporting it with qerror_report_err(). Change callers that assume the function can't fail to pass &error_abort, so that should the assumption ever break, it'll break noisily. Turns out all callers outside its unit test assume that. We could drop the Error ** argument, but that would make the interface less regular, so don't. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
c5c6d7f81a
commit
cccb7967bd
6 changed files with 19 additions and 18 deletions
|
@ -169,10 +169,10 @@ static void test_qemu_opt_get(void)
|
|||
|
||||
static void test_qemu_opt_get_bool(void)
|
||||
{
|
||||
Error *err = NULL;
|
||||
QemuOptsList *list;
|
||||
QemuOpts *opts;
|
||||
bool opt;
|
||||
int ret;
|
||||
|
||||
list = qemu_find_opts("opts_list_02");
|
||||
g_assert(list != NULL);
|
||||
|
@ -192,16 +192,16 @@ static void test_qemu_opt_get_bool(void)
|
|||
opt = qemu_opt_get_bool(opts, "bool1", false);
|
||||
g_assert(opt == false);
|
||||
|
||||
ret = qemu_opt_set_bool(opts, "bool1", true);
|
||||
g_assert(ret == 0);
|
||||
qemu_opt_set_bool(opts, "bool1", true, &err);
|
||||
g_assert(!err);
|
||||
|
||||
/* now we have set bool1, should know about it */
|
||||
opt = qemu_opt_get_bool(opts, "bool1", false);
|
||||
g_assert(opt == true);
|
||||
|
||||
/* having reset the value, opt should be the reset one not defval */
|
||||
ret = qemu_opt_set_bool(opts, "bool1", false);
|
||||
g_assert(ret == 0);
|
||||
qemu_opt_set_bool(opts, "bool1", false, &err);
|
||||
g_assert(!err);
|
||||
|
||||
opt = qemu_opt_get_bool(opts, "bool1", true);
|
||||
g_assert(opt == false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue