From 53cb2fc859bef4116bb5e8ef9a80ca6c05963d6f Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 4 Dec 2019 10:36:11 +0100 Subject: tests: Clean up initialization of Error *err variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Declaring a local Error *err without initializer looks suspicious. Fuse the declaration with the initialization to avoid that. Signed-off-by: Markus Armbruster Message-Id: <20191204093625.14836-5-armbru@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/test-qobject-output-visitor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/test-qobject-output-visitor.c') diff --git a/tests/test-qobject-output-visitor.c b/tests/test-qobject-output-visitor.c index 3e993e5ba8..d7761ebf84 100644 --- a/tests/test-qobject-output-visitor.c +++ b/tests/test-qobject-output-visitor.c @@ -145,10 +145,10 @@ static void test_visitor_out_enum_errors(TestOutputVisitorData *data, const void *unused) { EnumOne i, bad_values[] = { ENUM_ONE__MAX, -1 }; - Error *err; for (i = 0; i < ARRAY_SIZE(bad_values) ; i++) { - err = NULL; + Error *err = NULL; + visit_type_EnumOne(data->ov, "unused", &bad_values[i], &err); error_free_or_abort(&err); visitor_reset(data); @@ -240,11 +240,11 @@ static void test_visitor_out_struct_errors(TestOutputVisitorData *data, EnumOne bad_values[] = { ENUM_ONE__MAX, -1 }; UserDefOne u = {0}; UserDefOne *pu = &u; - Error *err; int i; for (i = 0; i < ARRAY_SIZE(bad_values) ; i++) { - err = NULL; + Error *err = NULL; + u.has_enum1 = true; u.enum1 = bad_values[i]; visit_type_UserDefOne(data->ov, "unused", &pu, &err); -- cgit v1.2.3