summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-08-13 16:13:36 +0000
committerLennart Poettering <lennart@poettering.net>2006-08-13 16:13:36 +0000
commitdb3f561ec4d6fe7b6deedff45802a5efd3ba4013 (patch)
tree15bd1b631288f372592a7448486bb18e76fa24bd /src/tests
parent281125c72767713d6294ac7094f3bf7bde47a1e3 (diff)
rework hook list stuff once again: change the callback prototype to recieve three data pointers: one to the data for the hook, once for the slot and once for the call
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1235 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/hook-list-test.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/tests/hook-list-test.c b/src/tests/hook-list-test.c
index 0d811a1e..d68d1b7d 100644
--- a/src/tests/hook-list-test.c
+++ b/src/tests/hook-list-test.c
@@ -3,13 +3,13 @@
#include <pulsecore/hook-list.h>
#include <pulsecore/log.h>
-static pa_hook_result_t func1(const char*a, void *userdata) {
- pa_log("#1 arg=%s userdata=%s", a, (char*) userdata);
+static pa_hook_result_t func1(const char*hook_data, const char*call_data, const char*slot_data) {
+ pa_log("(func1) hook=%s call=%s slot=%s", hook_data, call_data, slot_data);
return PA_HOOK_OK;
}
-static pa_hook_result_t func2(const char*a, void *userdata) {
- pa_log("#2 arg=%s userdata=%s", a, (char*) userdata);
+static pa_hook_result_t func2(const char*hook_data, const char*call_data, const char*slot_data) {
+ pa_log("(func2) hook=%s call=%s slot=%s", hook_data, call_data, slot_data);
return PA_HOOK_OK;
}
@@ -17,15 +17,18 @@ int main(int argc, char *argv[]) {
pa_hook hook;
pa_hook_slot *slot;
- pa_hook_init(&hook);
+ pa_hook_init(&hook, (void*) "hook");
- pa_hook_connect(&hook, (pa_hook_cb_t) func1, (void*) "1-1");
- slot = pa_hook_connect(&hook, (pa_hook_cb_t) func2, (void*) "2-1");
- pa_hook_connect(&hook, (pa_hook_cb_t) func1, (void*) "1-2");
+ pa_hook_connect(&hook, (pa_hook_cb_t) func1, (void*) "slot1");
+ slot = pa_hook_connect(&hook, (pa_hook_cb_t) func2, (void*) "slot2");
+ pa_hook_connect(&hook, (pa_hook_cb_t) func1, (void*) "slot3");
- pa_hook_fire(&hook, (void*) "arg2");
+ pa_hook_fire(&hook, (void*) "call1");
pa_hook_slot_free(slot);
+
+ pa_hook_fire(&hook, (void*) "call2");
+
pa_hook_free(&hook);
return 0;