aboutsummaryrefslogtreecommitdiff
path: root/tests/libqtest.h
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-12-02 21:20:33 +0100
committerAndreas Färber <afaerber@suse.de>2015-12-04 18:25:42 +0100
commit041088c71934b8991c21b61bd4ee91d76a6f2b07 (patch)
tree5c95c0d8a091f3049114984c21ec23c3e1999d57 /tests/libqtest.h
parent70ae0b6d0e7968a9ac1b85acb5697a6950654bf4 (diff)
tests: Use proper functions types instead of void (*fn)
We have several function parameters declared as void (*fn). This is just a stupid way to write void *, and the only purpose writing it like that could serve is obscuring the sin of bypassing the type system without need. The original sin is commit 49ee359: its qtest_add_func() is a wrapper for g_test_add_func(). Fix the parameter type to match g_test_add_func()'s. This uncovers type errors in ide-test.c; fix them. Commit 7949c0e faithfully repeated the sin for qtest_add_data_func(). Fix it the same way, along with a harmless type error uncovered in vhost-user-test.c. Commit 063c23d repeated it for qtest_add_abrt_handler(). The screwy parameter gets assigned to GHook member func, so change its type to match. Requires wrapping kill_qemu() to keep the type checker happy. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [AF/armbru: Inline GTestFunc/GTestDataFunc typedef for old GLib] Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'tests/libqtest.h')
-rw-r--r--tests/libqtest.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/libqtest.h b/tests/libqtest.h
index df087452ee..ebdd5bbe53 100644
--- a/tests/libqtest.h
+++ b/tests/libqtest.h
@@ -416,7 +416,7 @@ const char *qtest_get_arch(void);
* The path is prefixed with the architecture under test, as
* returned by qtest_get_arch().
*/
-void qtest_add_func(const char *str, void (*fn));
+void qtest_add_func(const char *str, void (*fn)(void));
/**
* qtest_add_data_func:
@@ -428,7 +428,8 @@ void qtest_add_func(const char *str, void (*fn));
* The path is prefixed with the architecture under test, as
* returned by qtest_get_arch().
*/
-void qtest_add_data_func(const char *str, const void *data, void (*fn));
+void qtest_add_data_func(const char *str, const void *data,
+ void (*fn)(const void *));
/**
* qtest_add:
@@ -450,7 +451,7 @@ void qtest_add_data_func(const char *str, const void *data, void (*fn));
g_free(path); \
} while (0)
-void qtest_add_abrt_handler(void (*fn), const void *data);
+void qtest_add_abrt_handler(GHookFunc fn, const void *data);
/**
* qtest_start: