From cccb7967bdf19f9d31e65d2d07d4d311e07545c4 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 12 Feb 2015 16:37:44 +0100 Subject: 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 Reviewed-by: Eric Blake --- tests/test-qemu-opts.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/test-qemu-opts.c b/tests/test-qemu-opts.c index ca08ac5..6b0ae33 100644 --- a/tests/test-qemu-opts.c +++ b/tests/test-qemu-opts.c @@ -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); -- cgit v1.1