]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
tests: Use error_free_or_abort() where appropriate
authorMarkus Armbruster <armbru@redhat.com>
Fri, 17 Feb 2017 20:15:54 +0000 (21:15 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Wed, 15 Mar 2017 07:52:09 +0000 (08:52 +0100)
Done with this Coccinelle semantic patch:

    @@
    expression E;
    @@
    -    g_assert(E);
    -    error_free(E);
    +    error_free_or_abort(&E);

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1487362554-5688-1-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
tests/test-qemu-opts.c
tests/test-qobject-output-visitor.c

index f6310b34f13d1b2724c3cdff4aaf9b511ef815c0..0ad74b464f2b6c50c6a377c777e1c01936237f6f 100644 (file)
@@ -93,8 +93,7 @@ static void test_find_unknown_opts(void)
     /* should not return anything, we don't have an "unknown" option */
     list = qemu_find_opts_err("unknown", &err);
     g_assert(list == NULL);
-    g_assert(err);
-    error_free(err);
+    error_free_or_abort(&err);
 }
 
 static void test_qemu_find_opts(void)
index 500b452d98efafd27d1c034405eda7207e042f2d..c213fceeb30d52aa7f3b249a1598cd2b50174054 100644 (file)
@@ -145,8 +145,7 @@ static void test_visitor_out_enum_errors(TestOutputVisitorData *data,
     for (i = 0; i < ARRAY_SIZE(bad_values) ; i++) {
         err = NULL;
         visit_type_EnumOne(data->ov, "unused", &bad_values[i], &err);
-        g_assert(err);
-        error_free(err);
+        error_free_or_abort(&err);
         visitor_reset(data);
     }
 }
@@ -244,8 +243,7 @@ static void test_visitor_out_struct_errors(TestOutputVisitorData *data,
         u.has_enum1 = true;
         u.enum1 = bad_values[i];
         visit_type_UserDefOne(data->ov, "unused", &pu, &err);
-        g_assert(err);
-        error_free(err);
+        error_free_or_abort(&err);
         visitor_reset(data);
     }
 }