module: Add hook dynarray

This small helper will simplify code in many modules.
The hooks added through pa_module_hook_connect will be freed just
before pa__done is called (so trying to add hooks during pa__done
will result in assertion failure).

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
David Henningsson 2015-03-27 11:20:11 +01:00
parent f0c9321b53
commit 127e8a1519
2 changed files with 20 additions and 0 deletions

View file

@ -26,6 +26,7 @@
typedef struct pa_module pa_module;
#include <pulse/proplist.h>
#include <pulsecore/dynarray.h>
#include <pulsecore/core.h>
@ -46,6 +47,7 @@ struct pa_module {
bool unload_requested:1;
pa_proplist *proplist;
pa_dynarray *hooks;
};
bool pa_module_exists(const char *name);
@ -64,6 +66,8 @@ int pa_module_get_n_used(pa_module*m);
void pa_module_update_proplist(pa_module *m, pa_update_mode_t mode, pa_proplist *p);
void pa_module_hook_connect(pa_module *m, pa_hook *hook, pa_hook_priority_t prio, pa_hook_cb_t cb, void *data);
#define PA_MODULE_AUTHOR(s) \
const char *pa__get_author(void) { return s; } \
struct __stupid_useless_struct_to_allow_trailing_semicolon