mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-16 08:56:40 -05:00
make it compile
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@4 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
9cb0b933e2
commit
a5daff7859
2 changed files with 11 additions and 7 deletions
15
src/module.c
15
src/module.c
|
|
@ -1,10 +1,12 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "module.h"
|
#include "module.h"
|
||||||
|
|
||||||
struct module* module_load(struct core *c, const char *name, const char *argument) {
|
struct module* module_load(struct core *c, const char *name, const char *argument) {
|
||||||
struct module *m = NULL;
|
struct module *m = NULL;
|
||||||
|
int r;
|
||||||
|
|
||||||
assert(c && name);
|
assert(c && name);
|
||||||
|
|
||||||
|
|
@ -23,6 +25,7 @@ struct module* module_load(struct core *c, const char *name, const char *argumen
|
||||||
m->name = strdup(name);
|
m->name = strdup(name);
|
||||||
m->argument = argument ? strdup(argument) : NULL;
|
m->argument = argument ? strdup(argument) : NULL;
|
||||||
m->userdata = NULL;
|
m->userdata = NULL;
|
||||||
|
m->core = c;
|
||||||
|
|
||||||
assert(m->init);
|
assert(m->init);
|
||||||
if (m->init(c, m) < 0)
|
if (m->init(c, m) < 0)
|
||||||
|
|
@ -30,6 +33,7 @@ struct module* module_load(struct core *c, const char *name, const char *argumen
|
||||||
|
|
||||||
if (!c->modules)
|
if (!c->modules)
|
||||||
c->modules = idxset_new(NULL, NULL);
|
c->modules = idxset_new(NULL, NULL);
|
||||||
|
|
||||||
|
|
||||||
assert(c->modules);
|
assert(c->modules);
|
||||||
r = idxset_put(c->modules, m, &m->index);
|
r = idxset_put(c->modules, m, &m->index);
|
||||||
|
|
@ -48,18 +52,17 @@ fail:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void module_free(struct module *m) {
|
static void module_free(struct module *m) {
|
||||||
assert(m && m->done);
|
assert(m && m->done && m->core);
|
||||||
m->done(c, m);
|
m->done(m->core, m);
|
||||||
|
|
||||||
lt_dlcose(m->dl);
|
lt_dlclose(m->dl);
|
||||||
free(m->name);
|
free(m->name);
|
||||||
free(m->argument);
|
free(m->argument);
|
||||||
free(m);
|
free(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void module_unload(struct core *c, struct module *m) {
|
void module_unload(struct core *c, struct module *m) {
|
||||||
struct module *m;
|
assert(c && m);
|
||||||
assert(c && index != IDXSET_INVALID);
|
|
||||||
|
|
||||||
assert(c->modules);
|
assert(c->modules);
|
||||||
if (!(m = idxset_remove_by_data(c->modules, m, NULL)))
|
if (!(m = idxset_remove_by_data(c->modules, m, NULL)))
|
||||||
|
|
@ -68,7 +71,7 @@ void module_unload(struct core *c, struct module *m) {
|
||||||
module_free(m);
|
module_free(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void module_unload_by_index(struct core *c, guint32_t index) {
|
void module_unload_by_index(struct core *c, uint32_t index) {
|
||||||
struct module *m;
|
struct module *m;
|
||||||
assert(c && index != IDXSET_INVALID);
|
assert(c && index != IDXSET_INVALID);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,11 @@
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
|
|
||||||
struct module {
|
struct module {
|
||||||
|
struct core *core;
|
||||||
char *name, *argument;
|
char *name, *argument;
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
|
|
||||||
lt_dlhandle *dl;
|
lt_dlhandle dl;
|
||||||
|
|
||||||
int (*init)(struct core *c, struct module*m);
|
int (*init)(struct core *c, struct module*m);
|
||||||
void (*done)(struct core *c, struct module*m);
|
void (*done)(struct core *c, struct module*m);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue