[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 08/23] test-throttle: Simplify qemu_init_main_loo
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH v2 08/23] test-throttle: Simplify qemu_init_main_loop() error handling |
Date: |
Thu, 17 Dec 2015 17:49:49 +0100 |
The code looks like it tries to check for both qemu_init_main_loop()
and qemu_get_aio_context() failure in one conditional. In fact,
qemu_get_aio_context() can fail only after qemu_init_main_loop()
failed.
Simplify accordingly: check for qemu_init_main_loop() error directly,
without bothering to improve its error message. Call
qemu_get_aio_context() only when qemu_get_aio_context() succeeded. It
can't fail then, so no need to check.
Signed-off-by: Markus Armbruster <address@hidden>
---
tests/test-throttle.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/tests/test-throttle.c b/tests/test-throttle.c
index 85c9b6c..a95039f 100644
--- a/tests/test-throttle.c
+++ b/tests/test-throttle.c
@@ -581,21 +581,8 @@ static void test_groups(void)
int main(int argc, char **argv)
{
- Error *local_error = NULL;
-
- qemu_init_main_loop(&local_error);
+ qemu_init_main_loop(&error_fatal);
ctx = qemu_get_aio_context();
-
- if (!ctx) {
- error_report("Failed to create AIO Context: '%s'",
- local_error ? error_get_pretty(local_error) :
- "Failed to initialize the QEMU main loop");
- if (local_error) {
- error_free(local_error);
- }
- exit(1);
- }
-
bdrv_init();
do {} while (g_main_context_iteration(NULL, false));
--
2.4.3
- Re: [Qemu-devel] [PATCH v2 10/23] error: Don't decorate original error message when adding to it, (continued)
- [Qemu-devel] [PATCH v2 15/23] qemu-io qemu-nbd: Use error_report() etc. instead of fprintf(), Markus Armbruster, 2015/12/17
- [Qemu-devel] [PATCH v2 14/23] migration: Use error_reportf_err() instead of monitor_printf(), Markus Armbruster, 2015/12/17
- [Qemu-devel] [PATCH v2 17/23] vmdk: Clean up control flow in vmdk_parse_extents() a bit, Markus Armbruster, 2015/12/17
- [Qemu-devel] [PATCH v2 08/23] test-throttle: Simplify qemu_init_main_loop() error handling,
Markus Armbruster <=
- [Qemu-devel] [PATCH v2 23/23] s390/sclp: Simplify control flow in sclp_realize(), Markus Armbruster, 2015/12/17
- [Qemu-devel] [PATCH v2 13/23] spapr: Use error_reportf_err(), Markus Armbruster, 2015/12/17
- [Qemu-devel] [PATCH v2 09/23] error: New error_prepend(), error_reportf_err(), Markus Armbruster, 2015/12/17
- [Qemu-devel] [PATCH v2 04/23] error: Use error_report_err() instead of ad hoc prints, Markus Armbruster, 2015/12/17