[pulseaudio-commits] r1615 - in /branches/lennart/src: ./ modules/ modules/gconf/ pulsecore/
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Fri Aug 10 07:28:40 PDT 2007
Author: lennart
Date: Fri Aug 10 16:28:39 2007
New Revision: 1615
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1615&root=3Dpulseaudio&vi=
ew=3Drev
Log:
* drop redundant pa_core argument from module initialization functions
* make pa__done() implementations optional
* a couple of modernizations
* wrap lt_dlsym() at a single place
* allow passing of an "api" argument to the HAL module, to choose whether O=
SS devices or ALSA devices should be picked up
* optimize fd closing a little on linux in the forked gconf helper
* save a little memory in the xsmp module
Added:
branches/lennart/src/pulsecore/ltdl-helper.c (with props)
branches/lennart/src/pulsecore/ltdl-helper.h (with props)
Modified:
branches/lennart/src/Makefile.am
branches/lennart/src/modules/gconf/module-gconf.c
branches/lennart/src/modules/module-alsa-sink.c
branches/lennart/src/modules/module-alsa-source.c
branches/lennart/src/modules/module-cli.c
branches/lennart/src/modules/module-defs.h.m4
branches/lennart/src/modules/module-detect.c
branches/lennart/src/modules/module-esound-compat-spawnfd.c
branches/lennart/src/modules/module-esound-compat-spawnpid.c
branches/lennart/src/modules/module-hal-detect.c
branches/lennart/src/modules/module-lirc.c
branches/lennart/src/modules/module-match.c
branches/lennart/src/modules/module-mmkbd-evdev.c
branches/lennart/src/modules/module-native-protocol-fd.c
branches/lennart/src/modules/module-null-sink.c
branches/lennart/src/modules/module-oss.c
branches/lennart/src/modules/module-pipe-sink.c
branches/lennart/src/modules/module-pipe-source.c
branches/lennart/src/modules/module-protocol-stub.c
branches/lennart/src/modules/module-rescue-streams.c
branches/lennart/src/modules/module-sine.c
branches/lennart/src/modules/module-suspend-on-idle.c
branches/lennart/src/modules/module-volume-restore.c
branches/lennart/src/modules/module-x11-bell.c
branches/lennart/src/modules/module-x11-publish.c
branches/lennart/src/modules/module-x11-xsmp.c
branches/lennart/src/modules/module-zeroconf-publish.c
branches/lennart/src/pulsecore/modinfo.c
branches/lennart/src/pulsecore/modinfo.h
branches/lennart/src/pulsecore/module.c
branches/lennart/src/pulsecore/module.h
Modified: branches/lennart/src/Makefile.am
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/Makefile.a=
m?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/Makefile.am (original)
+++ branches/lennart/src/Makefile.am Fri Aug 10 16:28:39 2007
@@ -624,6 +624,7 @@
pulsecore/memchunk.c pulsecore/memchunk.h \
pulsecore/modargs.c pulsecore/modargs.h \
pulsecore/modinfo.c pulsecore/modinfo.h \
+ pulsecore/ltdl-helper.c pulsecore/ltdl-helper.h \
pulsecore/module.c pulsecore/module.h \
pulsecore/namereg.c pulsecore/namereg.h \
pulsecore/pid.c pulsecore/pid.h \
@@ -1038,9 +1039,7 @@
BUILT_SOURCES +=3D $(SYMDEF_FILES)
=
$(SYMDEF_FILES): modules/module-defs.h.m4
- -mkdir modules
- -mkdir modules/gconf
- -mkdir modules/rtp
+ $(mkdir_p) modules modules/gconf modules/rtp
$(M4) -Dfname=3D"$@" $< > $@
=
# Simple protocol
Modified: branches/lennart/src/modules/gconf/module-gconf.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/gc=
onf/module-gconf.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3D=
diff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/gconf/module-gconf.c (original)
+++ branches/lennart/src/modules/gconf/module-gconf.c Fri Aug 10 16:28:39 2=
007
@@ -25,7 +25,6 @@
#include <config.h>
#endif
=
-#include <assert.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
@@ -34,6 +33,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <fcntl.h>
+#include <dirent.h>
=
#ifdef HAVE_SYS_PRCTL_H
#include <sys/prctl.h>
@@ -95,7 +95,7 @@
=
static int fill_buf(struct userdata *u) {
ssize_t r;
- assert(u);
+ pa_assert(u);
=
if (u->buf_fill >=3D BUF_MAX) {
pa_log("read buffer overflow");
@@ -111,21 +111,21 @@
=
static int read_byte(struct userdata *u) {
int ret;
- assert(u);
+ pa_assert(u);
=
if (u->buf_fill < 1)
if (fill_buf(u) < 0)
return -1;
=
ret =3D u->buf[0];
- assert(u->buf_fill > 0);
+ pa_assert(u->buf_fill > 0);
u->buf_fill--;
memmove(u->buf, u->buf+1, u->buf_fill);
return ret;
}
=
static char *read_string(struct userdata *u) {
- assert(u);
+ pa_assert(u);
=
for (;;) {
char *e;
@@ -143,9 +143,9 @@
}
=
static void unload_one_module(struct userdata *u, struct module_info*m, un=
signed i) {
- assert(u);
- assert(m);
- assert(i < m->n_items);
+ pa_assert(u);
+ pa_assert(m);
+ pa_assert(i < m->n_items);
=
if (m->items[i].index =3D=3D PA_INVALID_INDEX)
return;
@@ -161,8 +161,8 @@
static void unload_all_modules(struct userdata *u, struct module_info*m) {
unsigned i;
=
- assert(u);
- assert(m);
+ pa_assert(u);
+ pa_assert(m);
=
for (i =3D 0; i < m->n_items; i++)
unload_one_module(u, m, i);
@@ -180,10 +180,10 @@
=
pa_module *mod;
=
- assert(u);
- assert(m);
- assert(name);
- assert(args);
+ pa_assert(u);
+ pa_assert(m);
+ pa_assert(name);
+ pa_assert(args);
=
if (!is_new) {
if (m->items[i].index !=3D PA_INVALID_INDEX &&
@@ -212,8 +212,8 @@
struct module_info *m =3D p;
struct userdata *u =3D userdata;
=
- assert(m);
- assert(u);
+ pa_assert(m);
+ pa_assert(u);
=
unload_all_modules(u, m);
pa_xfree(m->name);
@@ -356,8 +356,10 @@
=
return pipe_fds[0];
} else {
+#ifdef __linux__
+ DIR* d;
+#endif
int max_fd, i;
-
/* child */
=
close(pipe_fds[0]);
@@ -372,18 +374,45 @@
close(2);
open("/dev/null", O_WRONLY);
=
- max_fd =3D 1024;
-
+#ifdef __linux__
+
+ if ((d =3D opendir("/proc/self/fd/"))) {
+
+ struct dirent *de;
+
+ while ((de =3D readdir(d))) {
+ char *e;
+ int fd;
+ =
+ errno =3D 0;
+ fd =3D strtol(de->d_name, &e, 10);
+ pa_assert(errno =3D=3D 0 && *e =3D=3D 0);
+
+ if (fd >=3D 3)
+ close(fd);
+ }
+ =
+ closedir(d);
+ } else {
+ =
+#endif
+ =
+ max_fd =3D 1024;
+ =
#ifdef HAVE_SYS_RESOURCE_H
- {
- struct rlimit r;
- if (getrlimit(RLIMIT_NOFILE, &r) =3D=3D 0)
- max_fd =3D r.rlim_max;
+ {
+ struct rlimit r;
+ if (getrlimit(RLIMIT_NOFILE, &r) =3D=3D 0)
+ max_fd =3D r.rlim_max;
+ }
+#endif
+ =
+ for (i =3D 3; i < max_fd; i++)
+ close(i);
+#
+#ifdef __linux__
}
#endif
-
- for (i =3D 3; i < max_fd; i++)
- close(i);
=
#ifdef PR_SET_PDEATHSIG
/* On Linux we can use PR_SET_PDEATHSIG to have the helper
@@ -413,12 +442,12 @@
return -1;
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
struct userdata *u;
int r;
=
u =3D pa_xnew(struct userdata, 1);
- u->core =3D c;
+ u->core =3D m->core;
u->module =3D m;
m->userdata =3D u;
u->module_infos =3D pa_hashmap_new(pa_idxset_string_hash_func, pa_idxs=
et_string_compare_func);
@@ -431,8 +460,8 @@
if ((u->fd =3D start_client(PA_GCONF_HELPER, &u->pid)) < 0)
goto fail;
=
- u->io_event =3D c->mainloop->io_new(
- c->mainloop,
+ u->io_event =3D m->core->mainloop->io_new(
+ m->core->mainloop,
u->fd,
PA_IO_EVENT_INPUT,
io_event_cb,
@@ -449,21 +478,20 @@
return 0;
=
fail:
- pa__done(c, m);
+ pa__done(m);
return -1;
}
=
-void pa__done(pa_core *c, pa_module*m) {
+void pa__done(pa_module*m) {
struct userdata *u;
=
- assert(c);
- assert(m);
+ pa_assert(m);
=
if (!(u =3D m->userdata))
return;
=
if (u->io_event)
- c->mainloop->io_free(u->io_event);
+ m->core->mainloop->io_free(u->io_event);
=
if (u->fd >=3D 0)
close(u->fd);
Modified: branches/lennart/src/modules/module-alsa-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-alsa-sink.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Ddi=
ff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-alsa-sink.c (original)
+++ branches/lennart/src/modules/module-alsa-sink.c Fri Aug 10 16:28:39 2007
@@ -704,7 +704,7 @@
pa_log_debug("Thread shutting down");
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
=
pa_modargs *ma =3D NULL;
int ret =3D -1;
@@ -723,7 +723,6 @@
int namereg_fail;
int use_mmap =3D 1, b;
=
- pa_assert(c);
pa_assert(m);
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
@@ -731,7 +730,7 @@
goto fail;
}
=
- ss =3D c->default_sample_spec;
+ ss =3D m->core->default_sample_spec;
if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map, PA_CHANN=
EL_MAP_ALSA) < 0) {
pa_log("Failed to parse sample specification and channel map");
goto fail;
@@ -756,7 +755,7 @@
}
=
u =3D pa_xnew0(struct userdata, 1);
- u->core =3D c;
+ u->core =3D m->core;
u->module =3D m;
m->userdata =3D u;
u->use_mmap =3D use_mmap;
@@ -824,7 +823,7 @@
namereg_fail =3D 0;
}
=
- u->sink =3D pa_sink_new(c, __FILE__, name, namereg_fail, &ss, &map);
+ u->sink =3D pa_sink_new(m->core, __FILE__, name, namereg_fail, &ss, &m=
ap);
pa_xfree(name_buf);
=
if (!u->sink) {
@@ -881,7 +880,7 @@
=
u->mixer_fdl =3D pa_alsa_fdlist_new();
=
- if (pa_alsa_fdlist_set_mixer(u->mixer_fdl, u->mixer_handle, c->mai=
nloop) < 0) {
+ if (pa_alsa_fdlist_set_mixer(u->mixer_fdl, u->mixer_handle, m->cor=
e->mainloop) < 0) {
pa_log("failed to initialise file descriptor monitoring");
goto fail;
}
@@ -917,15 +916,14 @@
fail:
=
if (u)
- pa__done(c, m);
+ pa__done(m);
=
goto finish;
}
=
-void pa__done(pa_core *c, pa_module*m) {
+void pa__done(pa_module*m) {
struct userdata *u;
=
- pa_assert(c);
pa_assert(m);
=
if (!(u =3D m->userdata))
Modified: branches/lennart/src/modules/module-alsa-source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-alsa-source.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3D=
diff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-alsa-source.c (original)
+++ branches/lennart/src/modules/module-alsa-source.c Fri Aug 10 16:28:39 2=
007
@@ -679,7 +679,7 @@
pa_log_debug("Thread shutting down");
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
=
pa_modargs *ma =3D NULL;
int ret =3D -1;
@@ -698,7 +698,6 @@
int namereg_fail;
int use_mmap =3D 1, b;
=
- pa_assert(c);
pa_assert(m);
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
@@ -706,7 +705,7 @@
goto fail;
}
=
- ss =3D c->default_sample_spec;
+ ss =3D m->core->default_sample_spec;
if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map, PA_CHANN=
EL_MAP_ALSA) < 0) {
pa_log("Failed to parse sample specification");
goto fail;
@@ -732,7 +731,7 @@
}
=
u =3D pa_xnew0(struct userdata, 1);
- u->core =3D c;
+ u->core =3D m->core;
u->module =3D m;
m->userdata =3D u;
u->use_mmap =3D use_mmap;
@@ -796,7 +795,7 @@
namereg_fail =3D 0;
}
=
- u->source =3D pa_source_new(c, __FILE__, name, namereg_fail, &ss, &map=
);
+ u->source =3D pa_source_new(m->core, __FILE__, name, namereg_fail, &ss=
, &map);
pa_xfree(name_buf);
=
if (!u->source) {
@@ -849,7 +848,7 @@
=
u->mixer_fdl =3D pa_alsa_fdlist_new();
=
- if (pa_alsa_fdlist_set_mixer(u->mixer_fdl, u->mixer_handle, c->mai=
nloop) < 0) {
+ if (pa_alsa_fdlist_set_mixer(u->mixer_fdl, u->mixer_handle, m->cor=
e->mainloop) < 0) {
pa_log("failed to initialise file descriptor monitoring");
goto fail;
}
@@ -886,15 +885,14 @@
fail:
=
if (u)
- pa__done(c, m);
+ pa__done(m);
=
goto finish;
}
=
-void pa__done(pa_core *c, pa_module*m) {
+void pa__done(pa_module*m) {
struct userdata *u;
=
- pa_assert(c);
pa_assert(m);
=
if (!(u =3D m->userdata))
Modified: branches/lennart/src/modules/module-cli.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-cli.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-cli.c (original)
+++ branches/lennart/src/modules/module-cli.c Fri Aug 10 16:28:39 2007
@@ -66,15 +66,14 @@
m->core->mainloop->quit(m->core->mainloop, 0);
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
pa_iochannel *io;
pa_modargs *ma;
int exit_on_eof =3D 0;
=
- assert(c);
assert(m);
=
- if (c->running_as_daemon) {
+ if (m->core->running_as_daemon) {
pa_log_info("Running as daemon, refusing to load this module.");
return 0;
}
@@ -94,12 +93,10 @@
goto fail;
}
=
- io =3D pa_iochannel_new(c->mainloop, STDIN_FILENO, STDOUT_FILENO);
- assert(io);
+ io =3D pa_iochannel_new(m->core->mainloop, STDIN_FILENO, STDOUT_FILENO=
);
pa_iochannel_set_noclose(io, 1);
=
- m->userdata =3D pa_cli_new(c, io, m);
- assert(m->userdata);
+ m->userdata =3D pa_cli_new(m->core, io, m);
=
pa_cli_set_eof_callback(m->userdata, exit_on_eof ? eof_and_exit_cb : e=
of_and_unload_cb, m);
=
@@ -115,11 +112,10 @@
return -1;
}
=
-void pa__done(pa_core *c, pa_module*m) {
- assert(c);
+void pa__done(pa_module*m) {
assert(m);
=
- if (c->running_as_daemon =3D=3D 0) {
+ if (m->core->running_as_daemon =3D=3D 0) {
pa_cli_free(m->userdata);
pa_stdio_release();
}
Modified: branches/lennart/src/modules/module-defs.h.m4
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-defs.h.m4?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-defs.h.m4 (original)
+++ branches/lennart/src/modules/module-defs.h.m4 Fri Aug 10 16:28:39 2007
@@ -18,8 +18,8 @@
gen_symbol(pa__get_usage)
gen_symbol(pa__get_version)
=
-int pa__init(struct pa_core *c, struct pa_module*m);
-void pa__done(struct pa_core *c, struct pa_module*m);
+int pa__init(pa_module*m);
+void pa__done(pa_module*m);
=
const char* pa__get_author(void);
const char* pa__get_description(void);
Modified: branches/lennart/src/modules/module-detect.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-detect.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-detect.c (original)
+++ branches/lennart/src/modules/module-detect.c Fri Aug 10 16:28:39 2007
@@ -52,6 +52,11 @@
PA_MODULE_VERSION(PACKAGE_VERSION)
PA_MODULE_USAGE("just-one=3D<boolean>")
=
+static const char* const valid_modargs[] =3D {
+ "just-one",
+ NULL
+};
+
#ifdef HAVE_ALSA
=
static int detect_alsa(pa_core *c, int just_one) {
@@ -215,17 +220,11 @@
}
#endif
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
int just_one =3D 0, n =3D 0;
pa_modargs *ma;
=
- static const char* const valid_modargs[] =3D {
- "just-one",
- NULL
- };
-
- assert(c);
- assert(m);
+ pa_assert(m);
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments");
@@ -238,16 +237,16 @@
}
=
#if HAVE_ALSA
- if ((n =3D detect_alsa(c, just_one)) <=3D 0)
+ if ((n =3D detect_alsa(m->core, just_one)) <=3D 0)
#endif
#if HAVE_OSS
- if ((n =3D detect_oss(c, just_one)) <=3D 0)
+ if ((n =3D detect_oss(m->core, just_one)) <=3D 0)
#endif
#if HAVE_SOLARIS
- if ((n =3D detect_solaris(c, just_one)) <=3D 0)
+ if ((n =3D detect_solaris(m->core, just_one)) <=3D 0)
#endif
#if OS_IS_WIN32
- if ((n =3D detect_waveout(c, just_one)) <=3D 0)
+ if ((n =3D detect_waveout(m->core, just_one)) <=3D 0)
#endif
{
pa_log_warn("failed to detect any sound hardware.");
@@ -269,9 +268,3 @@
=
return -1;
}
-
-
-void pa__done(PA_GCC_UNUSED pa_core *c, PA_GCC_UNUSED pa_module*m) {
- /* NOP */
-}
-
Modified: branches/lennart/src/modules/module-esound-compat-spawnfd.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-esound-compat-spawnfd.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D16=
15&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-esound-compat-spawnfd.c (original)
+++ branches/lennart/src/modules/module-esound-compat-spawnfd.c Fri Aug 10 =
16:28:39 2007
@@ -26,7 +26,6 @@
#endif
=
#include <unistd.h>
-#include <assert.h>
#include <string.h>
#include <errno.h>
=
@@ -48,21 +47,23 @@
NULL,
};
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
pa_modargs *ma =3D NULL;
int ret =3D -1, fd =3D -1;
char x =3D 1;
- assert(c && m);
+ =
+ pa_assert(m);
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs)) ||
pa_modargs_get_value_s32(ma, "fd", &fd) < 0 ||
fd < 0) {
+ =
pa_log("Failed to parse module arguments");
goto finish;
}
=
if (pa_loop_write(fd, &x, sizeof(x), NULL) !=3D sizeof(x))
- pa_log("WARNING: write(%u, 1, 1) failed: %s", fd, pa_cstrerror(err=
no));
+ pa_log_warn("WARNING: write(%u, 1, 1) failed: %s", fd, pa_cstrerro=
r(errno));
=
close(fd);
=
@@ -76,9 +77,3 @@
=
return ret;
}
-
-void pa__done(pa_core *c, pa_module*m) {
- assert(c && m);
-}
-
-
Modified: branches/lennart/src/modules/module-esound-compat-spawnpid.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-esound-compat-spawnpid.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1=
615&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-esound-compat-spawnpid.c (original)
+++ branches/lennart/src/modules/module-esound-compat-spawnpid.c Fri Aug 10=
16:28:39 2007
@@ -25,7 +25,6 @@
#endif
=
#include <unistd.h>
-#include <assert.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
@@ -48,11 +47,12 @@
NULL,
};
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
pa_modargs *ma =3D NULL;
int ret =3D -1;
uint32_t pid =3D 0;
- assert(c && m);
+ =
+ pa_assert(m);
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs)) ||
pa_modargs_get_value_u32(ma, "pid", &pid) < 0 ||
@@ -62,7 +62,7 @@
}
=
if (kill(pid, SIGUSR1) < 0)
- pa_log("WARNING: kill(%u) failed: %s", pid, pa_cstrerror(errno));
+ pa_log_warn("WARNING: kill(%u) failed: %s", pid, pa_cstrerror(errn=
o));
=
pa_module_unload_request(m);
=
@@ -74,9 +74,3 @@
=
return ret;
}
-
-void pa__done(pa_core *c, pa_module*m) {
- assert(c && m);
-}
-
-
Modified: branches/lennart/src/modules/module-hal-detect.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-hal-detect.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Dd=
iff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-hal-detect.c (original)
+++ branches/lennart/src/modules/module-hal-detect.c Fri Aug 10 16:28:39 20=
07
@@ -46,6 +46,7 @@
#include <pulsecore/core-util.h>
#include <pulsecore/namereg.h>
#include <pulsecore/core-scache.h>
+#include <pulsecore/modargs.h>
=
#include <hal/libhal.h>
=
@@ -55,6 +56,13 @@
PA_MODULE_AUTHOR("Shahms King")
PA_MODULE_DESCRIPTION("Detect available audio hardware and load matching d=
rivers")
PA_MODULE_VERSION(PACKAGE_VERSION)
+#if defined(HAVE_ALSA) && defined(HAVE_OSS)
+PA_MODULE_USAGE("api=3D<alsa or oss>")
+#elif defined(HAVE_ALSA)
+PA_MODULE_USAGE("api=3D<alsa>")
+#elif defined(HAVE_OSS)
+PA_MODULE_USAGE("api=3D<oss>")
+#endif
=
struct device {
uint32_t index;
@@ -77,6 +85,11 @@
=
#define CAPABILITY_ALSA "alsa"
#define CAPABILITY_OSS "oss"
+
+static const char* const valid_modargs[] =3D {
+ "api",
+ NULL
+};
=
static void hal_device_free(struct device* d) {
pa_assert(d);
@@ -663,37 +676,65 @@
return NULL;
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
DBusError error;
pa_dbus_connection *conn;
struct userdata *u =3D NULL;
LibHalContext *hal_context =3D NULL;
int n =3D 0;
- =
- pa_assert(c);
+ pa_modargs *ma;
+ const char *api;
+ =
pa_assert(m);
=
dbus_error_init(&error);
- =
- if (!(conn =3D pa_dbus_bus_get(c, DBUS_BUS_SYSTEM, &error)) || dbus_er=
ror_is_set(&error)) {
+
+ if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
+ pa_log("Failed to parse module arguments");
+ goto fail;
+ }
+
+ if ((api =3D pa_modargs_get_value(ma, "api", NULL))) {
+ int good =3D 0;
+
+#ifdef HAVE_ALSA
+ if (strcmp(api, CAPABILITY_ALSA) =3D=3D 0) {
+ good =3D 1;
+ api =3D CAPABILITY_ALSA;
+ } =
+#endif
+#ifdef HAVE_OSS
+ if (strcmp(api, CAPABILITY_OSS) =3D=3D 0) {
+ good =3D 1;
+ api =3D CAPABILITY_OSS;
+ }
+#endif
+ =
+ if (!good) {
+ pa_log_error("Invalid API specification.");
+ goto fail;
+ }
+ }
+ =
+ if (!(conn =3D pa_dbus_bus_get(m->core, DBUS_BUS_SYSTEM, &error)) || d=
bus_error_is_set(&error)) {
if (conn)
pa_dbus_connection_unref(conn);
pa_log_error("Unable to contact DBUS system bus: %s: %s", error.na=
me, error.message);
goto fail;
}
=
- if (!(hal_context =3D hal_context_new(c, pa_dbus_connection_get(conn))=
)) {
+ if (!(hal_context =3D hal_context_new(m->core, pa_dbus_connection_get(=
conn)))) {
/* pa_hal_context_new() logs appropriate errors */
pa_dbus_connection_unref(conn);
goto fail;
}
=
u =3D pa_xnew(struct userdata, 1);
- u->core =3D c;
+ u->core =3D m->core;
u->context =3D hal_context;
u->connection =3D conn;
u->devices =3D pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_st=
ring_compare_func);
- u->capability =3D NULL;
+ u->capability =3D api;
m->userdata =3D u;
=
#ifdef HAVE_ALSA
@@ -736,19 +777,24 @@
=
pa_log_info("Loaded %i modules.", n);
=
+ pa_modargs_free(ma);
+ =
return 0;
=
fail:
+ if (ma)
+ pa_modargs_free(ma);
+ =
dbus_error_free(&error);
- pa__done(c, m);
+ pa__done(m);
+
return -1;
}
=
=
-void pa__done(PA_GCC_UNUSED pa_core *c, pa_module *m) {
+void pa__done(pa_module *m) {
struct userdata *u;
=
- pa_assert(c);
pa_assert(m);
=
if (!(u =3D m->userdata))
Modified: branches/lennart/src/modules/module-lirc.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-lirc.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-lirc.c (original)
+++ branches/lennart/src/modules/module-lirc.c Fri Aug 10 16:28:39 2007
@@ -68,11 +68,12 @@
static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e,=
PA_GCC_UNUSED int fd, pa_io_event_flags_t events, void*userdata) {
struct userdata *u =3D userdata;
char *name =3D NULL, *code =3D NULL;
- assert(io);
- assert(u);
+
+ pa_assert(io);
+ pa_assert(u);
=
if (events & (PA_IO_EVENT_HANGUP|PA_IO_EVENT_ERROR)) {
- pa_log("lost connection to LIRC daemon.");
+ pa_log("Lost connection to LIRC daemon.");
goto fail;
}
=
@@ -86,7 +87,7 @@
=
c =3D pa_xstrdup(code);
c[strcspn(c, "\n\r")] =3D 0;
- pa_log_debug("raw IR code '%s'", c);
+ pa_log_debug("Raw IR code '%s'", c);
pa_xfree(c);
=
while (lirc_code2char(u->config, code, &name) =3D=3D 0 && name) {
@@ -99,7 +100,7 @@
MUTE_TOGGLE
} volchange =3D INVALID;
=
- pa_log_info("translated IR code '%s'", name);
+ pa_log_info("Translated IR code '%s'", name);
=
if (strcasecmp(name, "volume-up") =3D=3D 0)
volchange =3D UP;
@@ -113,12 +114,12 @@
volchange =3D RESET;
=
if (volchange =3D=3D INVALID)
- pa_log_warn("recieved unknown IR code '%s'", name);
+ pa_log_warn("Recieved unknown IR code '%s'", name);
else {
pa_sink *s;
=
if (!(s =3D pa_namereg_get(u->module->core, u->sink_name, =
PA_NAMEREG_SINK, 1)))
- pa_log("failed to get sink '%s'", u->sink_name);
+ pa_log("Failed to get sink '%s'", u->sink_name);
else {
int i;
pa_cvolume cv =3D *pa_sink_get_volume(s);
@@ -179,13 +180,14 @@
=
pa_module_unload_request(u->module);
=
- free(code);
+ pa_xfree(code);
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
pa_modargs *ma =3D NULL;
struct userdata *u;
- assert(c && m);
+ =
+ pa_assert(m);
=
if (lirc_in_use) {
pa_log("module-lirc may no be loaded twice.");
@@ -197,7 +199,7 @@
goto fail;
}
=
- m->userdata =3D u =3D pa_xmalloc(sizeof(struct userdata));
+ m->userdata =3D u =3D pa_xnew(struct userdata, 1);
u->module =3D m;
u->io =3D NULL;
u->config =3D NULL;
@@ -215,7 +217,7 @@
goto fail;
}
=
- u->io =3D c->mainloop->io_new(c->mainloop, u->lirc_fd, PA_IO_EVENT_INP=
UT|PA_IO_EVENT_HANGUP, io_callback, u);
+ u->io =3D m->core->mainloop->io_new(m->core->mainloop, u->lirc_fd, PA_=
IO_EVENT_INPUT|PA_IO_EVENT_HANGUP, io_callback, u);
=
lirc_in_use =3D 1;
=
@@ -228,14 +230,13 @@
if (ma)
pa_modargs_free(ma);
=
- pa__done(c, m);
+ pa__done(m);
return -1;
}
=
-void pa__done(pa_core *c, pa_module*m) {
+void pa__done(pa_module*m) {
struct userdata *u;
- assert(c);
- assert(m);
+ pa_assert(m);
=
if (!(u =3D m->userdata))
return;
Modified: branches/lennart/src/modules/module-match.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-match.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-match.c (original)
+++ branches/lennart/src/modules/module-match.c Fri Aug 10 16:28:39 2007
@@ -26,7 +26,6 @@
#endif
=
#include <unistd.h>
-#include <assert.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
@@ -80,6 +79,8 @@
struct rule *end =3D NULL;
char *fn =3D NULL;
=
+ pa_assert(u);
+
f =3D filename ?
fopen(fn =3D pa_xstrdup(filename), "r") :
pa_open_config_file(DEFAULT_MATCH_TABLE_FILE, DEFAULT_MATCH_TABLE_=
FILE_USER, NULL, &fn, "r");
@@ -132,7 +133,7 @@
goto finish;
}
=
- rule =3D pa_xmalloc(sizeof(struct rule));
+ rule =3D pa_xnew(struct rule, 1);
rule->regex =3D regex;
rule->volume =3D volume;
rule->next =3D NULL;
@@ -164,7 +165,9 @@
struct userdata *u =3D userdata;
pa_sink_input *si;
struct rule *r;
- assert(c && u);
+ =
+ pa_assert(c);
+ pa_assert(u);
=
if (t !=3D (PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_NEW=
))
return;
@@ -185,17 +188,18 @@
}
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
pa_modargs *ma =3D NULL;
struct userdata *u;
- assert(c && m);
+ =
+ pa_assert(m);
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments");
goto fail;
}
=
- u =3D pa_xmalloc(sizeof(struct userdata));
+ u =3D pa_xnew(struct userdata, 1);
u->rules =3D NULL;
u->subscription =3D NULL;
m->userdata =3D u;
@@ -203,23 +207,24 @@
if (load_rules(u, pa_modargs_get_value(ma, "table", NULL)) < 0)
goto fail;
=
- u->subscription =3D pa_subscription_new(c, PA_SUBSCRIPTION_MASK_SINK_I=
NPUT, callback, u);
+ u->subscription =3D pa_subscription_new(m->core, PA_SUBSCRIPTION_MASK_=
SINK_INPUT, callback, u);
=
pa_modargs_free(ma);
return 0;
=
fail:
- pa__done(c, m);
+ pa__done(m);
=
if (ma)
pa_modargs_free(ma);
return -1;
}
=
-void pa__done(pa_core *c, pa_module*m) {
+void pa__done(pa_module*m) {
struct userdata* u;
struct rule *r, *n;
- assert(c && m);
+ =
+ pa_assert(m);
=
if (!(u =3D m->userdata))
return;
Modified: branches/lennart/src/modules/module-mmkbd-evdev.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-mmkbd-evdev.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3D=
diff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-mmkbd-evdev.c (original)
+++ branches/lennart/src/modules/module-mmkbd-evdev.c Fri Aug 10 16:28:39 2=
007
@@ -26,7 +26,6 @@
#endif
=
#include <stdio.h>
-#include <assert.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
@@ -80,11 +79,12 @@
=
static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e,=
PA_GCC_UNUSED int fd, pa_io_event_flags_t events, void*userdata) {
struct userdata *u =3D userdata;
- assert(io);
- assert(u);
+ =
+ pa_assert(io);
+ pa_assert(u);
=
if (events & (PA_IO_EVENT_HANGUP|PA_IO_EVENT_ERROR)) {
- pa_log("lost connection to evdev device.");
+ pa_log("Lost connection to evdev device.");
goto fail;
}
=
@@ -92,14 +92,14 @@
struct input_event ev;
=
if (pa_loop_read(u->fd, &ev, sizeof(ev), &u->fd_type) <=3D 0) {
- pa_log("failed to read from event device: %s", pa_cstrerror(er=
rno));
+ pa_log("Failed to read from event device: %s", pa_cstrerror(er=
rno));
goto fail;
}
=
if (ev.type =3D=3D EV_KEY && (ev.value =3D=3D 1 || ev.value =3D=3D=
2)) {
enum { INVALID, UP, DOWN, MUTE_TOGGLE } volchange =3D INVALID;
=
- pa_log_debug("key code=3D%u, value=3D%u", ev.code, ev.value);
+ pa_log_debug("Key code=3D%u, value=3D%u", ev.code, ev.value);
=
switch (ev.code) {
case KEY_VOLUMEDOWN: volchange =3D DOWN; break;
@@ -111,7 +111,7 @@
pa_sink *s;
=
if (!(s =3D pa_namereg_get(u->module->core, u->sink_name, =
PA_NAMEREG_SINK, 1)))
- pa_log("failed to get sink '%s'", u->sink_name);
+ pa_log("Failed to get sink '%s'", u->sink_name);
else {
int i;
pa_cvolume cv =3D *pa_sink_get_volume(s);
@@ -165,21 +165,23 @@
=
#define test_bit(bit, array) (array[bit/8] & (1<<(bit%8)))
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
+ =
pa_modargs *ma =3D NULL;
struct userdata *u;
int version;
struct _input_id input_id;
char name[256];
uint8_t evtype_bitmask[EV_MAX/8 + 1];
- assert(c && m);
+
+ pa_assert(m);
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments");
goto fail;
}
=
- m->userdata =3D u =3D pa_xmalloc(sizeof(struct userdata));
+ m->userdata =3D u =3D pa_xnew(struct userdata,1);
u->module =3D m;
u->io =3D NULL;
u->sink_name =3D pa_xstrdup(pa_modargs_get_value(ma, "sink", NULL));
@@ -221,11 +223,11 @@
}
=
if (!test_bit(EV_KEY, evtype_bitmask)) {
- pa_log("device has no keys.");
- goto fail;
- }
-
- u->io =3D c->mainloop->io_new(c->mainloop, u->fd, PA_IO_EVENT_INPUT|PA=
_IO_EVENT_HANGUP, io_callback, u);
+ pa_log("Device has no keys.");
+ goto fail;
+ }
+
+ u->io =3D m->core->mainloop->io_new(m->core->mainloop, u->fd, PA_IO_EV=
ENT_INPUT|PA_IO_EVENT_HANGUP, io_callback, u);
=
pa_modargs_free(ma);
=
@@ -236,14 +238,14 @@
if (ma)
pa_modargs_free(ma);
=
- pa__done(c, m);
+ pa__done(m);
return -1;
}
=
-void pa__done(pa_core *c, pa_module*m) {
+void pa__done(pa_module*m) {
struct userdata *u;
- assert(c);
- assert(m);
+
+ pa_assert(m);
=
if (!(u =3D m->userdata))
return;
Modified: branches/lennart/src/modules/module-native-protocol-fd.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-native-protocol-fd.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&=
view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-native-protocol-fd.c (original)
+++ branches/lennart/src/modules/module-native-protocol-fd.c Fri Aug 10 16:=
28:39 2007
@@ -26,10 +26,10 @@
#endif
=
#include <stdio.h>
-#include <assert.h>
#include <unistd.h>
=
#include <pulsecore/module.h>
+#include <pulsecore/macro.h>
#include <pulsecore/iochannel.h>
#include <pulsecore/modargs.h>
#include <pulsecore/protocol-native.h>
@@ -48,25 +48,26 @@
NULL,
};
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
pa_iochannel *io;
pa_modargs *ma;
int fd, r =3D -1;
- assert(c && m);
+ =
+ pa_assert(m);
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
- pa_log("failed to parse module arguments.");
+ pa_log("Failed to parse module arguments.");
goto finish;
}
=
if (pa_modargs_get_value_s32(ma, "fd", &fd) < 0) {
- pa_log("invalid file descriptor.");
+ pa_log("Invalid file descriptor.");
goto finish;
}
=
- io =3D pa_iochannel_new(c->mainloop, fd, fd);
+ io =3D pa_iochannel_new(m->core->mainloop, fd, fd);
=
- if (!(m->userdata =3D pa_protocol_native_new_iochannel(c, io, m, ma)))=
{
+ if (!(m->userdata =3D pa_protocol_native_new_iochannel(m->core, io, m,=
ma))) {
pa_iochannel_free(io);
goto finish;
}
@@ -80,8 +81,8 @@
return r;
}
=
-void pa__done(pa_core *c, pa_module*m) {
- assert(c && m);
+void pa__done(pa_module*m) {
+ pa_assert(m);
=
pa_protocol_native_free(m->userdata);
}
Modified: branches/lennart/src/modules/module-null-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-null-sink.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Ddi=
ff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-null-sink.c (original)
+++ branches/lennart/src/modules/module-null-sink.c Fri Aug 10 16:28:39 2007
@@ -198,13 +198,12 @@
pa_log_debug("Thread shutting down");
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
struct userdata *u =3D NULL;
pa_sample_spec ss;
pa_channel_map map;
pa_modargs *ma =3D NULL;
=
- pa_assert(c);
pa_assert(m);
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
@@ -212,20 +211,20 @@
goto fail;
}
=
- ss =3D c->default_sample_spec;
+ ss =3D m->core->default_sample_spec;
if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map, PA_CHANN=
EL_MAP_DEFAULT) < 0) {
pa_log("Invalid sample format specification or channel map");
goto fail;
}
=
u =3D pa_xnew0(struct userdata, 1);
- u->core =3D c;
+ u->core =3D m->core;
u->module =3D m;
m->userdata =3D u;
=
pa_assert_se(u->asyncmsgq =3D pa_asyncmsgq_new(0));
=
- if (!(u->sink =3D pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "s=
ink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
+ if (!(u->sink =3D pa_sink_new(m->core, __FILE__, pa_modargs_get_value(=
ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
pa_log("Failed to create sink.");
goto fail;
}
@@ -254,15 +253,14 @@
if (ma)
pa_modargs_free(ma);
=
- pa__done(c, m);
+ pa__done(m);
=
return -1;
}
=
-void pa__done(pa_core *c, pa_module*m) {
+void pa__done(pa_module*m) {
struct userdata *u;
=
- pa_assert(c);
pa_assert(m);
=
if (!(u =3D m->userdata))
Modified: branches/lennart/src/modules/module-oss.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-oss.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-oss.c (original)
+++ branches/lennart/src/modules/module-oss.c Fri Aug 10 16:28:39 2007
@@ -1059,7 +1059,7 @@
pa_log_debug("Thread shutting down");
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
=
struct audio_buf_info info;
struct userdata *u =3D NULL;
@@ -1075,7 +1075,6 @@
const char *name;
int namereg_fail;
=
- pa_assert(c);
pa_assert(m);
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
@@ -1095,7 +1094,7 @@
=
mode =3D (playback && record) ? O_RDWR : (playback ? O_WRONLY : (recor=
d ? O_RDONLY : 0));
=
- ss =3D c->default_sample_spec;
+ ss =3D m->core->default_sample_spec;
if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map, PA_CHANN=
EL_MAP_OSS) < 0) {
pa_log("Failed to parse sample specification or channel map");
goto fail;
@@ -1150,7 +1149,7 @@
pa_assert(frag_size > 0);
=
u =3D pa_xnew0(struct userdata, 1);
- u->core =3D c;
+ u->core =3D m->core;
u->module =3D m;
m->userdata =3D u;
u->fd =3D fd;
@@ -1206,7 +1205,7 @@
namereg_fail =3D 0;
}
=
- u->source =3D pa_source_new(c, __FILE__, name, namereg_fail, &ss, =
&map);
+ u->source =3D pa_source_new(m->core, __FILE__, name, namereg_fail,=
&ss, &map);
pa_xfree(name_buf);
if (!u->source) {
pa_log("Failed to create source object");
@@ -1260,7 +1259,7 @@
namereg_fail =3D 0;
}
=
- u->sink =3D pa_sink_new(c, __FILE__, name, namereg_fail, &ss, &map=
);
+ u->sink =3D pa_sink_new(m->core, __FILE__, name, namereg_fail, &ss=
, &map);
pa_xfree(name_buf);
if (!u->sink) {
pa_log("Failed to create sink object");
@@ -1310,7 +1309,7 @@
fail:
=
if (u)
- pa__done(c, m);
+ pa__done(m);
else if (fd >=3D 0)
close(fd);
=
@@ -1320,10 +1319,9 @@
return -1;
}
=
-void pa__done(pa_core *c, pa_module*m) {
+void pa__done(pa_module*m) {
struct userdata *u;
=
- pa_assert(c);
pa_assert(m);
=
if (!(u =3D m->userdata))
Modified: branches/lennart/src/modules/module-pipe-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-pipe-sink.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Ddi=
ff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-pipe-sink.c (original)
+++ branches/lennart/src/modules/module-pipe-sink.c Fri Aug 10 16:28:39 2007
@@ -232,7 +232,7 @@
pa_log_debug("Thread shutting down");
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
struct userdata *u;
struct stat st;
pa_sample_spec ss;
@@ -240,7 +240,6 @@
pa_modargs *ma;
char *t;
=
- pa_assert(c);
pa_assert(m);
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
@@ -248,14 +247,14 @@
goto fail;
}
=
- ss =3D c->default_sample_spec;
+ ss =3D m->core->default_sample_spec;
if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map, PA_CHANN=
EL_MAP_DEFAULT) < 0) {
pa_log("Invalid sample format specification or channel map");
goto fail;
}
=
u =3D pa_xnew0(struct userdata, 1);
- u->core =3D c;
+ u->core =3D m->core;
u->module =3D m;
m->userdata =3D u;
pa_memchunk_reset(&u->memchunk);
@@ -283,7 +282,7 @@
goto fail;
}
=
- if (!(u->sink =3D pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "s=
ink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
+ if (!(u->sink =3D pa_sink_new(m->core, __FILE__, pa_modargs_get_value(=
ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
pa_log("Failed to create sink.");
goto fail;
}
@@ -309,15 +308,14 @@
if (ma)
pa_modargs_free(ma);
=
- pa__done(c, m);
+ pa__done(m);
=
return -1;
}
=
-void pa__done(pa_core *c, pa_module*m) {
+void pa__done(pa_module*m) {
struct userdata *u;
=
- pa_assert(c);
pa_assert(m);
=
if (!(u =3D m->userdata))
Modified: branches/lennart/src/modules/module-pipe-source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-pipe-source.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3D=
diff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-pipe-source.c (original)
+++ branches/lennart/src/modules/module-pipe-source.c Fri Aug 10 16:28:39 2=
007
@@ -210,7 +210,7 @@
pa_log_debug("Thread shutting down");
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
struct userdata *u;
struct stat st;
pa_sample_spec ss;
@@ -218,7 +218,6 @@
pa_modargs *ma;
char *t;
=
- pa_assert(c);
pa_assert(m);
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
@@ -226,14 +225,14 @@
goto fail;
}
=
- ss =3D c->default_sample_spec;
+ ss =3D m->core->default_sample_spec;
if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map, PA_CHANN=
EL_MAP_DEFAULT) < 0) {
pa_log("invalid sample format specification or channel map");
goto fail;
}
=
u =3D pa_xnew0(struct userdata, 1);
- u->core =3D c;
+ u->core =3D m->core;
u->module =3D m;
m->userdata =3D u;
pa_memchunk_reset(&u->memchunk);
@@ -261,7 +260,7 @@
goto fail;
}
=
- if (!(u->source =3D pa_source_new(c, __FILE__, pa_modargs_get_value(ma=
, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &map))) {
+ if (!(u->source =3D pa_source_new(m->core, __FILE__, pa_modargs_get_va=
lue(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &map))) {
pa_log("Failed to create source.");
goto fail;
}
@@ -286,15 +285,14 @@
if (ma)
pa_modargs_free(ma);
=
- pa__done(c, m);
+ pa__done(m);
=
return -1;
}
=
-void pa__done(pa_core *c, pa_module*m) {
+void pa__done(pa_module*m) {
struct userdata *u;
=
- pa_assert(c);
pa_assert(m);
=
if (!(u =3D m->userdata))
Modified: branches/lennart/src/modules/module-protocol-stub.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-protocol-stub.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=
=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-protocol-stub.c (original)
+++ branches/lennart/src/modules/module-protocol-stub.c Fri Aug 10 16:28:39=
2007
@@ -29,7 +29,6 @@
#include <string.h>
#include <errno.h>
#include <stdio.h>
-#include <assert.h>
#include <unistd.h>
#include <limits.h>
=
@@ -43,10 +42,9 @@
#include <netinet/in.h>
#endif
=
-#include "../pulsecore/winsock.h"
-
#include <pulse/xmalloc.h>
=
+#include <pulsecore/winsock.h>
#include <pulsecore/core-error.h>
#include <pulsecore/module.h>
#include <pulsecore/socket-server.h>
@@ -204,10 +202,9 @@
#endif
};
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
pa_modargs *ma =3D NULL;
int ret =3D -1;
-
struct userdata *u =3D NULL;
=
#if defined(USE_TCP_SOCKETS)
@@ -224,7 +221,7 @@
#endif
#endif
=
- assert(c && m);
+ pa_assert(m);
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments");
@@ -242,22 +239,22 @@
listen_on =3D pa_modargs_get_value(ma, "listen", NULL);
=
if (listen_on) {
- s_ipv6 =3D pa_socket_server_new_ipv6_string(c->mainloop, listen_on=
, port, TCPWRAP_SERVICE);
- s_ipv4 =3D pa_socket_server_new_ipv4_string(c->mainloop, listen_on=
, port, TCPWRAP_SERVICE);
+ s_ipv6 =3D pa_socket_server_new_ipv6_string(m->core->mainloop, lis=
ten_on, port, TCPWRAP_SERVICE);
+ s_ipv4 =3D pa_socket_server_new_ipv4_string(m->core->mainloop, lis=
ten_on, port, TCPWRAP_SERVICE);
} else {
- s_ipv6 =3D pa_socket_server_new_ipv6_any(c->mainloop, port, TCPWRA=
P_SERVICE);
- s_ipv4 =3D pa_socket_server_new_ipv4_any(c->mainloop, port, TCPWRA=
P_SERVICE);
+ s_ipv6 =3D pa_socket_server_new_ipv6_any(m->core->mainloop, port, =
TCPWRAP_SERVICE);
+ s_ipv4 =3D pa_socket_server_new_ipv4_any(m->core->mainloop, port, =
TCPWRAP_SERVICE);
}
=
if (!s_ipv4 && !s_ipv6)
goto fail;
=
if (s_ipv4)
- if (!(u->protocol_ipv4 =3D protocol_new(c, s_ipv4, m, ma)))
+ if (!(u->protocol_ipv4 =3D protocol_new(m->core, s_ipv4, m, ma)))
pa_socket_server_unref(s_ipv4);
=
if (s_ipv6)
- if (!(u->protocol_ipv6 =3D protocol_new(c, s_ipv6, m, ma)))
+ if (!(u->protocol_ipv6 =3D protocol_new(m->core, s_ipv6, m, ma)))
pa_socket_server_unref(s_ipv6);
=
if (!u->protocol_ipv4 && !u->protocol_ipv6)
@@ -274,7 +271,7 @@
/* This socket doesn't reside in our own runtime dir but in
* /tmp/.esd/, hence we have to create the dir first */
=
- if (pa_make_secure_parent_dir(u->socket_path, c->is_system_instance ? =
0755 : 0700, (uid_t)-1, (gid_t)-1) < 0) {
+ if (pa_make_secure_parent_dir(u->socket_path, m->core->is_system_insta=
nce ? 0755 : 0700, (uid_t)-1, (gid_t)-1) < 0) {
pa_log("Failed to create socket directory '%s': %s\n", u->socket_p=
ath, pa_cstrerror(errno));
goto fail;
}
@@ -292,10 +289,10 @@
if (r)
pa_log("Removed stale UNIX socket '%s'.", tmp);
=
- if (!(s =3D pa_socket_server_new_unix(c->mainloop, tmp)))
- goto fail;
-
- if (!(u->protocol_unix =3D protocol_new(c, s, m, ma)))
+ if (!(s =3D pa_socket_server_new_unix(m->core->mainloop, tmp)))
+ goto fail;
+
+ if (!(u->protocol_unix =3D protocol_new(m->core, s, m, ma)))
goto fail;
=
#endif
@@ -341,11 +338,10 @@
goto finish;
}
=
-void pa__done(pa_core *c, pa_module*m) {
+void pa__done(pa_module*m) {
struct userdata *u;
=
- assert(c);
- assert(m);
+ pa_assert(m);
=
u =3D m->userdata;
=
@@ -366,7 +362,6 @@
}
#endif
=
-
pa_xfree(u->socket_path);
#endif
=
Modified: branches/lennart/src/modules/module-rescue-streams.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-rescue-streams.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=
=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-rescue-streams.c (original)
+++ branches/lennart/src/modules/module-rescue-streams.c Fri Aug 10 16:28:3=
9 2007
@@ -126,11 +126,10 @@
return PA_HOOK_OK;
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
pa_modargs *ma =3D NULL;
struct userdata *u;
=
- pa_assert(c);
pa_assert(m);
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
@@ -139,17 +138,16 @@
}
=
m->userdata =3D u =3D pa_xnew(struct userdata, 1);
- u->sink_slot =3D pa_hook_connect(&c->hook_sink_disconnect, (pa_hook_cb=
_t) sink_hook_callback, NULL);
- u->source_slot =3D pa_hook_connect(&c->hook_source_disconnect, (pa_hoo=
k_cb_t) source_hook_callback, NULL);
+ u->sink_slot =3D pa_hook_connect(&m->core->hook_sink_disconnect, (pa_h=
ook_cb_t) sink_hook_callback, NULL);
+ u->source_slot =3D pa_hook_connect(&m->core->hook_source_disconnect, (=
pa_hook_cb_t) source_hook_callback, NULL);
=
pa_modargs_free(ma);
return 0;
}
=
-void pa__done(pa_core *c, pa_module*m) {
+void pa__done(pa_module*m) {
struct userdata *u;
=
- pa_assert(c);
pa_assert(m);
=
if (!m->userdata)
Modified: branches/lennart/src/modules/module-sine.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-sine.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-sine.c (original)
+++ branches/lennart/src/modules/module-sine.c Fri Aug 10 16:28:39 2007
@@ -114,7 +114,7 @@
f[i] =3D (float) sin((double) i/l*M_PI*2*freq)/2;
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
pa_modargs *ma =3D NULL;
struct userdata *u;
pa_sink *sink;
@@ -130,13 +130,13 @@
}
=
m->userdata =3D u =3D pa_xnew0(struct userdata, 1);
- u->core =3D c;
+ u->core =3D m->core;
u->module =3D m;
u->sink_input =3D NULL;
u->memblock =3D NULL;
u->peek_index =3D 0;
=
- if (!(sink =3D pa_namereg_get(c, pa_modargs_get_value(ma, "sink", NULL=
), PA_NAMEREG_SINK, 1))) {
+ if (!(sink =3D pa_namereg_get(m->core, pa_modargs_get_value(ma, "sink"=
, NULL), PA_NAMEREG_SINK, 1))) {
pa_log("No such sink.");
goto fail;
}
@@ -151,7 +151,7 @@
goto fail;
}
=
- u->memblock =3D pa_memblock_new(c->mempool, pa_bytes_per_second(&ss));
+ u->memblock =3D pa_memblock_new(m->core->mempool, pa_bytes_per_second(=
&ss));
p =3D pa_memblock_acquire(u->memblock);
calc_sine(p, pa_memblock_get_length(u->memblock), frequency);
pa_memblock_release(u->memblock);
@@ -165,7 +165,7 @@
pa_sink_input_new_data_set_sample_spec(&data, &ss);
data.module =3D m;
=
- if (!(u->sink_input =3D pa_sink_input_new(c, &data, 0)))
+ if (!(u->sink_input =3D pa_sink_input_new(m->core, &data, 0)))
goto fail;
=
u->sink_input->peek =3D sink_input_peek_cb;
@@ -182,14 +182,13 @@
if (ma)
pa_modargs_free(ma);
=
- pa__done(c, m);
+ pa__done(m);
return -1;
}
=
-void pa__done(pa_core *c, pa_module*m) {
- struct userdata *u;
- =
- pa_assert(c);
+void pa__done(pa_module*m) {
+ struct userdata *u;
+ =
pa_assert(m);
=
if (!(u =3D m->userdata))
Modified: branches/lennart/src/modules/module-suspend-on-idle.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-suspend-on-idle.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&vie=
w=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-suspend-on-idle.c (original)
+++ branches/lennart/src/modules/module-suspend-on-idle.c Fri Aug 10 16:28:=
39 2007
@@ -209,7 +209,7 @@
return PA_HOOK_OK;
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
pa_modargs *ma =3D NULL;
struct userdata *u;
uint32_t timeout =3D 5;
@@ -217,8 +217,7 @@
pa_sink *sink;
pa_source *source;
=
- assert(c);
- assert(m);
+ pa_assert(m);
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments.");
@@ -231,25 +230,25 @@
}
=
m->userdata =3D u =3D pa_xnew(struct userdata, 1);
- u->core =3D c;
+ u->core =3D m->core;
u->timeout =3D timeout;
u->device_infos =3D pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idx=
set_trivial_compare_func);
=
- for (sink =3D pa_idxset_first(c->sinks, &idx); sink; sink =3D pa_idxse=
t_next(c->sinks, &idx))
- device_new_hook_cb(c, PA_OBJECT(sink), u);
-
- for (source =3D pa_idxset_first(c->sources, &idx); source; source =3D =
pa_idxset_next(c->sources, &idx))
- device_new_hook_cb(c, PA_OBJECT(source), u);
-
- u->sink_new_slot =3D pa_hook_connect(&c->hook_sink_new_post, (pa_hook_=
cb_t) device_new_hook_cb, u);
- u->source_new_slot =3D pa_hook_connect(&c->hook_source_new_post, (pa_h=
ook_cb_t) device_new_hook_cb, u);
- u->sink_disconnect_slot =3D pa_hook_connect(&c->hook_sink_disconnect_p=
ost, (pa_hook_cb_t) device_disconnect_hook_cb, u);
- u->source_disconnect_slot =3D pa_hook_connect(&c->hook_source_disconne=
ct_post, (pa_hook_cb_t) device_disconnect_hook_cb, u);
-
- u->sink_input_new_slot =3D pa_hook_connect(&c->hook_sink_input_new_pos=
t, (pa_hook_cb_t) sink_input_new_hook_cb, u);
- u->source_output_new_slot =3D pa_hook_connect(&c->hook_source_output_n=
ew_post, (pa_hook_cb_t) source_output_new_hook_cb, u);
- u->sink_input_disconnect_slot =3D pa_hook_connect(&c->hook_sink_input_=
disconnect_post, (pa_hook_cb_t) sink_input_disconnect_hook_cb, u);
- u->source_output_disconnect_slot =3D pa_hook_connect(&c->hook_source_o=
utput_disconnect_post, (pa_hook_cb_t) source_output_disconnect_hook_cb, u);
+ for (sink =3D pa_idxset_first(m->core->sinks, &idx); sink; sink =3D pa=
_idxset_next(m->core->sinks, &idx))
+ device_new_hook_cb(m->core, PA_OBJECT(sink), u);
+
+ for (source =3D pa_idxset_first(m->core->sources, &idx); source; sourc=
e =3D pa_idxset_next(m->core->sources, &idx))
+ device_new_hook_cb(m->core, PA_OBJECT(source), u);
+
+ u->sink_new_slot =3D pa_hook_connect(&m->core->hook_sink_new_post, (pa=
_hook_cb_t) device_new_hook_cb, u);
+ u->source_new_slot =3D pa_hook_connect(&m->core->hook_source_new_post,=
(pa_hook_cb_t) device_new_hook_cb, u);
+ u->sink_disconnect_slot =3D pa_hook_connect(&m->core->hook_sink_discon=
nect_post, (pa_hook_cb_t) device_disconnect_hook_cb, u);
+ u->source_disconnect_slot =3D pa_hook_connect(&m->core->hook_source_di=
sconnect_post, (pa_hook_cb_t) device_disconnect_hook_cb, u);
+
+ u->sink_input_new_slot =3D pa_hook_connect(&m->core->hook_sink_input_n=
ew_post, (pa_hook_cb_t) sink_input_new_hook_cb, u);
+ u->source_output_new_slot =3D pa_hook_connect(&m->core->hook_source_ou=
tput_new_post, (pa_hook_cb_t) source_output_new_hook_cb, u);
+ u->sink_input_disconnect_slot =3D pa_hook_connect(&m->core->hook_sink_=
input_disconnect_post, (pa_hook_cb_t) sink_input_disconnect_hook_cb, u);
+ u->source_output_disconnect_slot =3D pa_hook_connect(&m->core->hook_so=
urce_output_disconnect_post, (pa_hook_cb_t) source_output_disconnect_hook_c=
b, u);
=
pa_modargs_free(ma);
return 0;
@@ -262,12 +261,11 @@
return -1;
}
=
-void pa__done(pa_core *c, pa_module*m) {
+void pa__done(pa_module*m) {
struct userdata *u;
struct device_info *d;
=
- assert(c);
- assert(m);
+ pa_assert(m);
=
if (!m->userdata)
return;
Modified: branches/lennart/src/modules/module-volume-restore.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-volume-restore.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=
=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-volume-restore.c (original)
+++ branches/lennart/src/modules/module-volume-restore.c Fri Aug 10 16:28:3=
9 2007
@@ -420,11 +420,10 @@
return PA_HOOK_OK;
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
pa_modargs *ma =3D NULL;
struct userdata *u;
=
- assert(c);
assert(m);
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
@@ -444,16 +443,15 @@
if (load_rules(u) < 0)
goto fail;
=
- u->subscription =3D pa_subscription_new(c, PA_SUBSCRIPTION_MASK_SINK_I=
NPUT|PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT, subscribe_callback, u);
- u->sink_input_hook_slot =3D pa_hook_connect(&c->hook_sink_input_new, (=
pa_hook_cb_t) sink_input_hook_callback, u);
- u->source_output_hook_slot =3D pa_hook_connect(&c->hook_source_output_=
new, (pa_hook_cb_t) source_output_hook_callback, u);
+ u->subscription =3D pa_subscription_new(m->core, PA_SUBSCRIPTION_MASK_=
SINK_INPUT|PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT, subscribe_callback, u);
+ u->sink_input_hook_slot =3D pa_hook_connect(&m->core->hook_sink_input_=
new, (pa_hook_cb_t) sink_input_hook_callback, u);
+ u->source_output_hook_slot =3D pa_hook_connect(&m->core->hook_source_o=
utput_new, (pa_hook_cb_t) source_output_hook_callback, u);
=
pa_modargs_free(ma);
return 0;
=
fail:
- pa__done(c, m);
-
+ pa__done(m);
if (ma)
pa_modargs_free(ma);
=
@@ -470,10 +468,9 @@
pa_xfree(r);
}
=
-void pa__done(pa_core *c, pa_module*m) {
+void pa__done(pa_module*m) {
struct userdata* u;
=
- assert(c);
assert(m);
=
if (!(u =3D m->userdata))
Modified: branches/lennart/src/modules/module-x11-bell.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-x11-bell.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-x11-bell.c (original)
+++ branches/lennart/src/modules/module-x11-bell.c Fri Aug 10 16:28:39 2007
@@ -88,14 +88,13 @@
return 1;
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
=
struct userdata *u =3D NULL;
pa_modargs *ma =3D NULL;
int major, minor;
unsigned int auto_ctrls, auto_values;
=
- pa_assert(c);
pa_assert(m);
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
@@ -104,12 +103,12 @@
}
=
m->userdata =3D u =3D pa_xnew(struct userdata, 1);
- u->core =3D c;
+ u->core =3D m->core;
u->scache_item =3D pa_xstrdup(pa_modargs_get_value(ma, "sample", "x11-=
bell"));
u->sink_name =3D pa_xstrdup(pa_modargs_get_value(ma, "sink", NULL));
u->x11_client =3D NULL;
=
- if (!(u->x11_wrapper =3D pa_x11_wrapper_get(c, pa_modargs_get_value(ma=
, "display", NULL))))
+ if (!(u->x11_wrapper =3D pa_x11_wrapper_get(m->core, pa_modargs_get_va=
lue(ma, "display", NULL))))
goto fail;
=
major =3D XkbMajorVersion;
@@ -143,16 +142,15 @@
if (ma)
pa_modargs_free(ma);
=
- pa__done(c, m);
+ pa__done(m);
=
return -1;
}
=
-void pa__done(pa_core *c, pa_module*m) {
+void pa__done(pa_module*m) {
struct userdata *u;
=
- assert(c);
- assert(m);
+ pa_assert(m);
=
if (!m->userdata)
return;
Modified: branches/lennart/src/modules/module-x11-publish.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-x11-publish.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3D=
diff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-x11-publish.c (original)
+++ branches/lennart/src/modules/module-x11-publish.c Fri Aug 10 16:28:39 2=
007
@@ -26,7 +26,6 @@
#endif
=
#include <stdio.h>
-#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -76,7 +75,7 @@
};
=
static int load_key(struct userdata *u, const char*fn) {
- assert(u);
+ pa_assert(u);
=
u->auth_cookie_in_property =3D 0;
=
@@ -93,7 +92,7 @@
if (pa_authkey_load_auto(fn, u->auth_cookie, sizeof(u->auth_cookie)) <=
0)
return -1;
=
- pa_log_debug("loading cookie from disk.");
+ pa_log_debug("Loading cookie from disk.");
=
if (pa_authkey_prop_put(u->core, PA_NATIVE_COOKIE_PROPERTY_NAME, u->au=
th_cookie, sizeof(u->auth_cookie)) >=3D 0)
u->auth_cookie_in_property =3D 1;
@@ -101,7 +100,7 @@
return 0;
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
struct userdata *u;
pa_modargs *ma =3D NULL;
char hn[256], un[128];
@@ -110,23 +109,25 @@
char *s;
pa_strlist *l;
=
+ pa_assert(m);
+ =
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
pa_log("failed to parse module arguments");
goto fail;
}
=
m->userdata =3D u =3D pa_xmalloc(sizeof(struct userdata));
- u->core =3D c;
+ u->core =3D m->core;
u->id =3D NULL;
u->auth_cookie_in_property =3D 0;
=
if (load_key(u, pa_modargs_get_value(ma, "cookie", NULL)) < 0)
goto fail;
=
- if (!(u->x11_wrapper =3D pa_x11_wrapper_get(c, pa_modargs_get_value(ma=
, "display", NULL))))
+ if (!(u->x11_wrapper =3D pa_x11_wrapper_get(m->core, pa_modargs_get_va=
lue(ma, "display", NULL))))
goto fail;
=
- if (!(l =3D pa_property_get(c, PA_NATIVE_SERVER_PROPERTY_NAME)))
+ if (!(l =3D pa_property_get(m->core, PA_NATIVE_SERVER_PROPERTY_NAME)))
goto fail;
=
s =3D pa_strlist_tostring(l);
@@ -154,13 +155,14 @@
if (ma)
pa_modargs_free(ma);
=
- pa__done(c, m);
+ pa__done(m);
return -1;
}
=
-void pa__done(pa_core *c, pa_module*m) {
+void pa__done(pa_module*m) {
struct userdata*u;
- assert(c && m);
+ =
+ pa_assert(m);
=
if (!(u =3D m->userdata))
return;
@@ -185,7 +187,7 @@
pa_x11_wrapper_unref(u->x11_wrapper);
=
if (u->auth_cookie_in_property)
- pa_authkey_prop_unref(c, PA_NATIVE_COOKIE_PROPERTY_NAME);
+ pa_authkey_prop_unref(m->core, PA_NATIVE_COOKIE_PROPERTY_NAME);
=
pa_xfree(u->id);
pa_xfree(u);
Modified: branches/lennart/src/modules/module-x11-xsmp.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-x11-xsmp.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-x11-xsmp.c (original)
+++ branches/lennart/src/modules/module-x11-xsmp.c Fri Aug 10 16:28:39 2007
@@ -49,17 +49,14 @@
PA_MODULE_DESCRIPTION("X11 session management")
PA_MODULE_VERSION(PACKAGE_VERSION)
=
-struct userdata {
- pa_core *core;
- SmcConn sm_conn;
-};
+static int ice_in_use =3D 0;
=
static const char* const valid_modargs[] =3D {
NULL
};
=
static void die_cb(SmcConn connection, SmPointer client_data){
- pa_core *c =3D client_data;
+ pa_core *c =3D PA_CORE(client_data);
=
pa_log_debug("Got die message from XSM. Exiting...");
=
@@ -98,17 +95,25 @@
c->mainloop->io_free(*watch_data);
}
=
-int pa__init(pa_core *c, pa_module*m) {
- struct userdata *u =3D NULL;
+int pa__init(pa_module*m) {
+
pa_modargs *ma =3D NULL;
char t[256], *vendor, *client_id;
SmcCallbacks callbacks;
SmProp prop_program, prop_user;
SmProp *prop_list[2];
SmPropValue val_program, val_user;
+ SmcConn connection;
=
- pa_assert(c);
pa_assert(m);
+
+ if (ice_in_use) {
+ pa_log("module-x11-xsmp may no be loaded twice.");
+ return -1;
+ }
+ =
+ IceAddConnectionWatch(new_ice_connection, m->core);
+ ice_in_use =3D 1;
=
if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments");
@@ -119,23 +124,19 @@
pa_log("X11 session manager not running.");
goto fail;
}
-
- m->userdata =3D u =3D pa_xnew(struct userdata, 1);
- u->core =3D c;
- u->sm_conn =3D NULL;
-
- IceAddConnectionWatch(new_ice_connection, c);
=
memset(&callbacks, 0, sizeof(callbacks));
callbacks.die.callback =3D die_cb;
- callbacks.die.client_data =3D c;
-
+ callbacks.die.client_data =3D m->core;
callbacks.save_yourself.callback =3D save_yourself_cb;
+ callbacks.save_yourself.client_data =3D m->core;
callbacks.save_complete.callback =3D save_complete_cb;
+ callbacks.save_complete.client_data =3D m->core;
callbacks.shutdown_cancelled.callback =3D shutdown_cancelled_cb;
+ callbacks.shutdown_cancelled.client_data =3D m->core;
=
- if (!(u->sm_conn =3D SmcOpenConnection(
- NULL, u,
+ if (!(m->userdata =3D connection =3D SmcOpenConnection(
+ NULL, m->core,
SmProtoMajor, SmProtoMinor,
SmcSaveYourselfProcMask | SmcDieProcMask | SmcSaveComple=
teProcMask | SmcShutdownCancelledProcMask,
&callbacks, NULL, &client_id,
@@ -162,9 +163,9 @@
prop_user.vals =3D &val_user;
prop_list[1] =3D &prop_user;
=
- SmcSetProperties(u->sm_conn, PA_ELEMENTSOF(prop_list), prop_list);
+ SmcSetProperties(connection, PA_ELEMENTSOF(prop_list), prop_list);
=
- pa_log_info("Connected to session manager '%s' as '%s'.", vendor =3D S=
mcVendor(u->sm_conn), client_id);
+ pa_log_info("Connected to session manager '%s' as '%s'.", vendor =3D S=
mcVendor(connection), client_id);
free(vendor);
free(client_id);
=
@@ -176,26 +177,19 @@
if (ma)
pa_modargs_free(ma);
=
- pa__done(c, m);
+ pa__done(m);
=
return -1;
}
=
-void pa__done(pa_core *c, pa_module*m) {
- struct userdata *u;
- =
- assert(c);
- assert(m);
+void pa__done(pa_module*m) {
+ pa_assert(m);
=
- if (!m->userdata)
- return;
+ if (m->userdata)
+ SmcCloseConnection(m->userdata, 0, NULL);
=
- u =3D m->userdata;
-
- if (u->sm_conn)
- SmcCloseConnection(u->sm_conn, 0, NULL);
-
- IceRemoveConnectionWatch(new_ice_connection, c);
- =
- pa_xfree(u);
+ if (ice_in_use) {
+ IceRemoveConnectionWatch(new_ice_connection, m->core);
+ ice_in_use =3D 0;
+ }
}
Modified: branches/lennart/src/modules/module-zeroconf-publish.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-zeroconf-publish.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&vi=
ew=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-zeroconf-publish.c (original)
+++ branches/lennart/src/modules/module-zeroconf-publish.c Fri Aug 10 16:28=
:39 2007
@@ -102,25 +102,25 @@
};
=
static void get_service_data(struct userdata *u, struct service *s, pa_sam=
ple_spec *ret_ss, char **ret_description) {
- assert(u && s && s->loaded.valid && ret_ss && ret_description);
+ pa_assert(u && s && s->loaded.valid && ret_ss && ret_description);
=
if (s->loaded.type =3D=3D PA_NAMEREG_SINK) {
pa_sink *sink =3D pa_idxset_get_by_index(u->core->sinks, s->loaded=
.index);
- assert(sink);
+ pa_assert(sink);
*ret_ss =3D sink->sample_spec;
*ret_description =3D sink->description;
} else if (s->loaded.type =3D=3D PA_NAMEREG_SOURCE) {
pa_source *source =3D pa_idxset_get_by_index(u->core->sources, s->=
loaded.index);
- assert(source);
+ pa_assert(source);
*ret_ss =3D source->sample_spec;
*ret_description =3D source->description;
} else
- assert(0);
+ pa_assert(0);
}
=
static AvahiStringList* txt_record_server_data(pa_core *c, AvahiStringList=
*l) {
char s[128];
- assert(c);
+ pa_assert(c);
=
l =3D avahi_string_list_add_pair(l, "server-version", PACKAGE_NAME" "P=
ACKAGE_VERSION);
l =3D avahi_string_list_add_pair(l, "user-name", pa_get_user_name(s, s=
izeof(s)));
@@ -150,8 +150,8 @@
int r =3D -1;
AvahiStringList *txt =3D NULL;
=
- assert(u);
- assert(s);
+ pa_assert(u);
+ pa_assert(s);
=
if (!u->client || avahi_client_get_state(u->client) !=3D AVAHI_CLIENT_=
S_RUNNING)
return 0;
@@ -265,7 +265,7 @@
static int publish_sink(struct userdata *u, pa_sink *s) {
struct service *svc;
int ret;
- assert(u && s);
+ pa_assert(u && s);
=
svc =3D get_service(u, s->name, s->description);
if (svc->loaded.valid)
@@ -286,7 +286,7 @@
struct service *svc;
int ret;
=
- assert(u && s);
+ pa_assert(u && s);
=
svc =3D get_service(u, s->name, s->description);
if (svc->loaded.valid)
@@ -309,7 +309,7 @@
struct service *svc;
int ret;
=
- assert(u && s);
+ pa_assert(u && s);
=
svc =3D get_service(u, s->name, NULL);
if (svc->autoload.valid)
@@ -328,7 +328,7 @@
=
static int remove_sink(struct userdata *u, uint32_t idx) {
struct service *svc;
- assert(u && idx !=3D PA_INVALID_INDEX);
+ pa_assert(u && idx !=3D PA_INVALID_INDEX);
=
if (!(svc =3D pa_dynarray_get(u->sink_dynarray, idx)))
return 0;
@@ -344,7 +344,7 @@
=
static int remove_source(struct userdata *u, uint32_t idx) {
struct service *svc;
- assert(u && idx !=3D PA_INVALID_INDEX);
+ pa_assert(u && idx !=3D PA_INVALID_INDEX);
=
if (!(svc =3D pa_dynarray_get(u->source_dynarray, idx)))
return 0;
@@ -360,7 +360,7 @@
=
static int remove_autoload(struct userdata *u, uint32_t idx) {
struct service *svc;
- assert(u && idx !=3D PA_INVALID_INDEX);
+ pa_assert(u && idx !=3D PA_INVALID_INDEX);
=
if (!(svc =3D pa_dynarray_get(u->autoload_dynarray, idx)))
return 0;
@@ -376,7 +376,7 @@
=
static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t,=
uint32_t idx, void *userdata) {
struct userdata *u =3D userdata;
- assert(u && c);
+ pa_assert(u && c);
=
switch (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK)
case PA_SUBSCRIPTION_EVENT_SINK: {
@@ -439,7 +439,7 @@
=
static void main_entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupS=
tate state, void *userdata) {
struct userdata *u =3D userdata;
- assert(u);
+ pa_assert(u);
=
if (state =3D=3D AVAHI_ENTRY_GROUP_COLLISION) {
char *t;
@@ -501,7 +501,7 @@
int r =3D -1;
uint32_t idx;
=
- assert(u);
+ pa_assert(u);
=
pa_log_debug("Publishing services in Zeroconf");
=
@@ -531,7 +531,7 @@
void *state =3D NULL;
struct service *s;
=
- assert(u);
+ pa_assert(u);
=
pa_log_debug("Unpublishing services in Zeroconf");
=
@@ -558,7 +558,7 @@
=
static void client_callback(AvahiClient *c, AvahiClientState state, void *=
userdata) {
struct userdata *u =3D userdata;
- assert(c);
+ pa_assert(c);
=
u->client =3D c;
=
@@ -587,7 +587,8 @@
}
}
=
-int pa__init(pa_core *c, pa_module*m) {
+int pa__init(pa_module*m) {
+ =
struct userdata *u;
uint32_t port =3D PA_NATIVE_DEFAULT_PORT;
pa_modargs *ma =3D NULL;
@@ -599,23 +600,23 @@
goto fail;
}
=
- if (pa_modargs_get_value_u32(ma, "port", &port) < 0 || port =3D=3D 0 |=
| port >=3D 0xFFFF) {
+ if (pa_modargs_get_value_u32(ma, "port", &port) < 0 || port <=3D 0 || =
port > 0xFFFF) {
pa_log("invalid port specified.");
goto fail;
}
=
m->userdata =3D u =3D pa_xnew(struct userdata, 1);
- u->core =3D c;
+ u->core =3D m->core;
u->port =3D (uint16_t) port;
=
- u->avahi_poll =3D pa_avahi_poll_new(c->mainloop);
+ u->avahi_poll =3D pa_avahi_poll_new(m->core->mainloop);
=
u->services =3D pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_s=
tring_compare_func);
u->sink_dynarray =3D pa_dynarray_new();
u->source_dynarray =3D pa_dynarray_new();
u->autoload_dynarray =3D pa_dynarray_new();
=
- u->subscription =3D pa_subscription_new(c,
+ u->subscription =3D pa_subscription_new(m->core,
PA_SUBSCRIPTION_MASK_SINK|
PA_SUBSCRIPTION_MASK_SOURCE|
PA_SUBSCRIPTION_MASK_AUTOLOAD, s=
ubscribe_callback, u);
@@ -634,7 +635,7 @@
return 0;
=
fail:
- pa__done(c, m);
+ pa__done(m);
=
if (ma)
pa_modargs_free(ma);
@@ -646,8 +647,8 @@
struct service *s =3D p;
struct userdata *u =3D userdata;
=
- assert(s);
- assert(u);
+ pa_assert(s);
+ pa_assert(u);
=
if (s->entry_group)
avahi_entry_group_free(s->entry_group);
@@ -657,9 +658,9 @@
pa_xfree(s);
}
=
-void pa__done(pa_core *c, pa_module*m) {
+void pa__done(pa_module*m) {
struct userdata*u;
- assert(c && m);
+ pa_assert(m);
=
if (!(u =3D m->userdata))
return;
Added: branches/lennart/src/pulsecore/ltdl-helper.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
ltdl-helper.c?rev=3D1615&root=3Dpulseaudio&view=3Dauto
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/ltdl-helper.c (added)
+++ branches/lennart/src/pulsecore/ltdl-helper.c Fri Aug 10 16:28:39 2007
@@ -1,0 +1,64 @@
+/* $Id$ */
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+ Copyright 2006 Pierre Ossman <ossman at cendio.se> for Cendio AB
+
+ PulseAudio is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2 of the License,
+ or (at your option) any later version.
+
+ PulseAudio is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <ctype.h>
+
+#include <pulse/xmalloc.h>
+#include <pulse/util.h>
+
+#include <pulsecore/core-util.h>
+#include <pulsecore/macro.h>
+
+#include "ltdl-helper.h"
+
+pa_void_func_t pa_load_sym(lt_dlhandle handle, const char *module, const c=
har *symbol) {
+ char *sn, *c;
+ pa_void_func_t f;
+
+ pa_assert(handle);
+ pa_assert(module);
+ pa_assert(symbol);
+ =
+ if ((f =3D ((pa_void_func_t) (long) lt_dlsym(handle, symbol))))
+ return f;
+
+ /* As the .la files might have been cleansed from the system, we should
+ * try with the ltdl prefix as well. */
+
+ sn =3D pa_sprintf_malloc("%s_LTX_%s", module, symbol);
+
+ for (c =3D sn; *c; c++)
+ if (!isalnum(*c))
+ *c =3D '_';
+
+ f =3D (pa_void_func_t) (long) lt_dlsym(handle, sn);
+ pa_xfree(sn);
+
+ return f;
+}
Propchange: branches/lennart/src/pulsecore/ltdl-helper.c
---------------------------------------------------------------------------=
---
svn:keywords =3D Id
Added: branches/lennart/src/pulsecore/ltdl-helper.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
ltdl-helper.h?rev=3D1615&root=3Dpulseaudio&view=3Dauto
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/ltdl-helper.h (added)
+++ branches/lennart/src/pulsecore/ltdl-helper.h Fri Aug 10 16:28:39 2007
@@ -1,0 +1,34 @@
+#ifndef foopulsecoreltdlhelperhfoo
+#define foopulsecoreltdlhelperhfoo
+
+/* $Id$ */
+
+/***
+ This file is part of PulseAudio.
+
+ Copyright 2004-2006 Lennart Poettering
+
+ PulseAudio is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2 of the License,
+ or (at your option) any later version.
+
+ PulseAudio is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA.
+***/
+
+#include <ltdl.h>
+
+typedef void (*pa_void_func_t)(void);
+
+pa_void_func_t pa_load_sym(lt_dlhandle handle, const char*module, const ch=
ar *symbol);
+
+#endif
+
Propchange: branches/lennart/src/pulsecore/ltdl-helper.h
---------------------------------------------------------------------------=
---
svn:keywords =3D Id
Modified: branches/lennart/src/pulsecore/modinfo.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
modinfo.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/modinfo.c (original)
+++ branches/lennart/src/pulsecore/modinfo.c Fri Aug 10 16:28:39 2007
@@ -26,12 +26,13 @@
#endif
=
#include <ltdl.h>
-#include <assert.h>
=
#include <pulse/xmalloc.h>
=
#include <pulsecore/core-util.h>
#include <pulsecore/log.h>
+#include <pulsecore/macro.h>
+#include <pulsecore/ltdl-helper.h>
=
#include "modinfo.h"
=
@@ -40,30 +41,24 @@
#define PA_SYMBOL_USAGE "pa__get_usage"
#define PA_SYMBOL_VERSION "pa__get_version"
=
-/* lt_dlsym() violates ISO C, so confide the breakage into this function to
- * avoid warnings. */
-typedef void (*fnptr)(void);
-static inline fnptr lt_dlsym_fn(lt_dlhandle handle, const char *symbol) {
- return (fnptr) (long) lt_dlsym(handle, symbol);
-}
-
-pa_modinfo *pa_modinfo_get_by_handle(lt_dlhandle dl) {
+pa_modinfo *pa_modinfo_get_by_handle(lt_dlhandle dl, const char *module_na=
me) {
pa_modinfo *i;
const char* (*func)(void);
- assert(dl);
+
+ pa_assert(dl);
=
i =3D pa_xnew0(pa_modinfo, 1);
=
- if ((func =3D (const char* (*)(void)) lt_dlsym_fn(dl, PA_SYMBOL_AUTHOR=
)))
+ if ((func =3D (const char* (*)(void)) pa_load_sym(dl, module_name, PA_=
SYMBOL_AUTHOR)))
i->author =3D pa_xstrdup(func());
=
- if ((func =3D (const char* (*)(void)) lt_dlsym_fn(dl, PA_SYMBOL_DESCRI=
PTION)))
+ if ((func =3D (const char* (*)(void)) pa_load_sym(dl, module_name, PA_=
SYMBOL_DESCRIPTION)))
i->description =3D pa_xstrdup(func());
=
- if ((func =3D (const char* (*)(void)) lt_dlsym_fn(dl, PA_SYMBOL_USAGE)=
))
+ if ((func =3D (const char* (*)(void)) pa_load_sym(dl, module_name, PA_=
SYMBOL_USAGE)))
i->usage =3D pa_xstrdup(func());
=
- if ((func =3D (const char* (*)(void)) lt_dlsym_fn(dl, PA_SYMBOL_VERSIO=
N)))
+ if ((func =3D (const char* (*)(void)) pa_load_sym(dl, module_name, PA_=
SYMBOL_VERSION)))
i->version =3D pa_xstrdup(func());
=
return i;
@@ -72,14 +67,15 @@
pa_modinfo *pa_modinfo_get_by_name(const char *name) {
lt_dlhandle dl;
pa_modinfo *i;
- assert(name);
+ =
+ pa_assert(name);
=
if (!(dl =3D lt_dlopenext(name))) {
pa_log("Failed to open module \"%s\": %s", name, lt_dlerror());
return NULL;
}
=
- i =3D pa_modinfo_get_by_handle(dl);
+ i =3D pa_modinfo_get_by_handle(dl, name);
lt_dlclose(dl);
=
return i;
@@ -87,6 +83,7 @@
=
void pa_modinfo_free(pa_modinfo *i) {
assert(i);
+ =
pa_xfree(i->author);
pa_xfree(i->description);
pa_xfree(i->usage);
Modified: branches/lennart/src/pulsecore/modinfo.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
modinfo.h?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/modinfo.h (original)
+++ branches/lennart/src/pulsecore/modinfo.h Fri Aug 10 16:28:39 2007
@@ -34,7 +34,7 @@
} pa_modinfo;
=
/* Read meta data from an libtool handle */
-pa_modinfo *pa_modinfo_get_by_handle(lt_dlhandle dl);
+pa_modinfo *pa_modinfo_get_by_handle(lt_dlhandle dl, const char *module_na=
me);
=
/* Read meta data from a module file */
pa_modinfo *pa_modinfo_get_by_name(const char *name);
Modified: branches/lennart/src/pulsecore/module.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
module.c?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/module.c (original)
+++ branches/lennart/src/pulsecore/module.c Fri Aug 10 16:28:39 2007
@@ -29,7 +29,6 @@
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
@@ -40,6 +39,8 @@
#include <pulsecore/core-subscribe.h>
#include <pulsecore/log.h>
#include <pulsecore/core-util.h>
+#include <pulsecore/macro.h>
+#include <pulsecore/ltdl-helper.h>
=
#include "module.h"
=
@@ -48,69 +49,31 @@
=
#define UNLOAD_POLL_TIME 2
=
-/* lt_dlsym() violates ISO C, so confide the breakage into this function to
- * avoid warnings. */
-typedef void (*fnptr)(void);
-static inline fnptr lt_dlsym_fn(lt_dlhandle handle, const char *symbol) {
- return (fnptr) (long) lt_dlsym(handle, symbol);
-}
-
static void timeout_callback(pa_mainloop_api *m, pa_time_event*e, PA_GCC_U=
NUSED const struct timeval *tv, void *userdata) {
- pa_core *c =3D userdata;
+ pa_core *c =3D PA_CORE(userdata);
struct timeval ntv;
- assert(c && c->mainloop =3D=3D m && c->module_auto_unload_event =3D=3D=
e);
+
+ pa_core_assert_ref(c);
+ pa_assert(c->mainloop =3D=3D m);
+ pa_assert(c->module_auto_unload_event =3D=3D e);
=
pa_module_unload_unused(c);
=
pa_gettimeofday(&ntv);
- ntv.tv_sec +=3D UNLOAD_POLL_TIME;
+ pa_timeval_add(&ntv, UNLOAD_POLL_TIME*1000000);
m->time_restart(e, &ntv);
-}
-
-static inline fnptr load_sym(lt_dlhandle handle, const char *module, const=
char *symbol) {
- char *buffer, *ch;
- size_t buflen;
- fnptr res;
-
- res =3D lt_dlsym_fn(handle, symbol);
- if (res)
- return res;
-
- /* As the .la files might have been cleansed from the system, we should
- * try with the ltdl prefix as well. */
-
- buflen =3D strlen(symbol) + strlen(module) + strlen("_LTX_") + 1;
- buffer =3D pa_xmalloc(buflen);
- assert(buffer);
-
- strcpy(buffer, module);
-
- for (ch =3D buffer;*ch !=3D '\0';ch++) {
- if (!isalnum(*ch))
- *ch =3D '_';
- }
-
- strcat(buffer, "_LTX_");
- strcat(buffer, symbol);
-
- res =3D lt_dlsym_fn(handle, buffer);
-
- pa_xfree(buffer);
-
- return res;
}
=
pa_module* pa_module_load(pa_core *c, const char *name, const char *argume=
nt) {
pa_module *m =3D NULL;
- int r;
-
- assert(c && name);
+
+ pa_assert(c);
+ pa_assert(name);
=
if (c->disallow_module_loading)
goto fail;
=
- m =3D pa_xmalloc(sizeof(pa_module));
-
+ m =3D pa_xnew(pa_module, 1);
m->name =3D pa_xstrdup(name);
m->argument =3D pa_xstrdup(argument);
=
@@ -119,24 +82,19 @@
goto fail;
}
=
- if (!(m->init =3D (int (*)(pa_core *_c, pa_module*_m)) load_sym(m->dl,=
name, PA_SYMBOL_INIT))) {
+ if (!(m->init =3D (int (*)(pa_module*_m)) pa_load_sym(m->dl, name, PA_=
SYMBOL_INIT))) {
pa_log("Failed to load module \"%s\": symbol \""PA_SYMBOL_INIT"\" =
not found.", name);
goto fail;
}
=
- if (!(m->done =3D (void (*)(pa_core *_c, pa_module*_m)) load_sym(m->dl=
, name, PA_SYMBOL_DONE))) {
- pa_log("Failed to load module \"%s\": symbol \""PA_SYMBOL_DONE"\" =
not found.", name);
- goto fail;
- }
-
+ m->done =3D (void (*)(pa_module*_m)) pa_load_sym(m->dl, name, PA_SYMBO=
L_DONE);
m->userdata =3D NULL;
m->core =3D c;
m->n_used =3D -1;
m->auto_unload =3D 0;
m->unload_requested =3D 0;
=
- assert(m->init);
- if (m->init(c, m) < 0) {
+ if (m->init(m) < 0) {
pa_log_error("Failed to load module \"%s\" (argument: \"%s\"): in=
itialization failed.", name, argument ? argument : "");
goto fail;
}
@@ -147,14 +105,12 @@
if (!c->module_auto_unload_event) {
struct timeval ntv;
pa_gettimeofday(&ntv);
- ntv.tv_sec +=3D UNLOAD_POLL_TIME;
+ pa_timeval_add(&ntv, UNLOAD_POLL_TIME*1000000);
c->module_auto_unload_event =3D c->mainloop->time_new(c->mainloop,=
&ntv, timeout_callback, c);
}
- assert(c->module_auto_unload_event);
-
- assert(c->modules);
- r =3D pa_idxset_put(c->modules, m, &m->index);
- assert(r >=3D 0 && m->index !=3D PA_IDXSET_INVALID);
+
+ pa_assert_se(pa_idxset_put(c->modules, m, &m->index) >=3D 0);
+ pa_assert(m->index !=3D PA_IDXSET_INVALID);
=
pa_log_info("Loaded \"%s\" (index: #%u; argument: \"%s\").", m->name, =
m->index, m->argument ? m->argument : "");
=
@@ -178,14 +134,16 @@
}
=
static void pa_module_free(pa_module *m) {
- assert(m && m->done && m->core);
+ pa_assert(m);
+ pa_assert(m->core);
=
if (m->core->disallow_module_loading)
return;
=
pa_log_info("Unloading \"%s\" (index: #%u).", m->name, m->index);
=
- m->done(m->core, m);
+ if (m->done)
+ m->done(m);
=
lt_dlclose(m->dl);
=
@@ -199,9 +157,9 @@
}
=
void pa_module_unload(pa_core *c, pa_module *m) {
- assert(c && m);
-
- assert(c->modules);
+ pa_assert(c && m);
+
+ pa_assert(c->modules);
if (!(m =3D pa_idxset_remove_by_data(c->modules, m, NULL)))
return;
=
@@ -210,9 +168,9 @@
=
void pa_module_unload_by_index(pa_core *c, uint32_t idx) {
pa_module *m;
- assert(c && idx !=3D PA_IDXSET_INVALID);
-
- assert(c->modules);
+ pa_assert(c);
+ pa_assert(idx !=3D PA_IDXSET_INVALID);
+
if (!(m =3D pa_idxset_remove_by_index(c->modules, idx)))
return;
=
@@ -221,13 +179,14 @@
=
static void free_callback(void *p, PA_GCC_UNUSED void *userdata) {
pa_module *m =3D p;
- assert(m);
+ pa_assert(m);
pa_module_free(m);
}
=
void pa_module_unload_all(pa_core *c) {
pa_module *m;
- assert(c);
+ =
+ pa_assert(c);
=
if (!c->modules)
return;
@@ -252,7 +211,10 @@
static int unused_callback(void *p, PA_GCC_UNUSED uint32_t idx, int *del, =
void *userdata) {
pa_module *m =3D p;
time_t *now =3D userdata;
- assert(p && del && now);
+ =
+ pa_assert(m);
+ pa_assert(del);
+ pa_assert(now);
=
if (m->n_used =3D=3D 0 && m->auto_unload && m->last_used_time+m->core-=
>module_idle_time <=3D *now) {
pa_module_free(m);
@@ -264,7 +226,7 @@
=
void pa_module_unload_unused(pa_core *c) {
time_t now;
- assert(c);
+ pa_assert(c);
=
if (!c->modules)
return;
@@ -275,7 +237,7 @@
=
static int unload_callback(void *p, PA_GCC_UNUSED uint32_t idx, int *del, =
PA_GCC_UNUSED void *userdata) {
pa_module *m =3D p;
- assert(m);
+ pa_assert(m);
=
if (m->unload_requested) {
pa_module_free(m);
@@ -286,18 +248,19 @@
}
=
static void defer_cb(pa_mainloop_api*api, pa_defer_event *e, void *userdat=
a) {
- pa_core *core =3D userdata;
+ pa_core *core =3D PA_CORE(userdata);
+
+ pa_core_assert_ref(core);
api->defer_enable(e, 0);
=
if (!core->modules)
return;
=
pa_idxset_foreach(core->modules, unload_callback, NULL);
-
}
=
void pa_module_unload_request(pa_module *m) {
- assert(m);
+ pa_assert(m);
=
m->unload_requested =3D 1;
=
@@ -308,19 +271,19 @@
}
=
void pa_module_set_used(pa_module*m, int used) {
- assert(m);
+ pa_assert(m);
=
if (m->n_used !=3D used)
pa_subscription_post(m->core, PA_SUBSCRIPTION_EVENT_MODULE|PA_SUBS=
CRIPTION_EVENT_CHANGE, m->index);
=
- if (m->n_used !=3D used && used =3D=3D 0)
+ if (used =3D=3D 0 && m->n_used > 0)
time(&m->last_used_time);
=
m->n_used =3D used;
}
=
pa_modinfo *pa_module_get_info(pa_module *m) {
- assert(m);
-
- return pa_modinfo_get_by_handle(m->dl);
-}
+ pa_assert(m);
+
+ return pa_modinfo_get_by_handle(m->dl, m->name);
+}
Modified: branches/lennart/src/pulsecore/module.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
module.h?rev=3D1615&root=3Dpulseaudio&r1=3D1614&r2=3D1615&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/module.h (original)
+++ branches/lennart/src/pulsecore/module.h Fri Aug 10 16:28:39 2007
@@ -39,8 +39,8 @@
=
lt_dlhandle dl;
=
- int (*init)(pa_core *c, pa_module*m);
- void (*done)(pa_core *c, pa_module*m);
+ int (*init)(pa_module*m);
+ void (*done)(pa_module*m);
=
void *userdata;
=
@@ -62,9 +62,9 @@
=
void pa_module_set_used(pa_module*m, int used);
=
-#define PA_MODULE_AUTHOR(s) const char * pa__get_author(void) { return s; }
-#define PA_MODULE_DESCRIPTION(s) const char * pa__get_description(void) { =
return s; }
-#define PA_MODULE_USAGE(s) const char * pa__get_usage(void) { return s; }
+#define PA_MODULE_AUTHOR(s) const char *pa__get_author(void) { return s; }
+#define PA_MODULE_DESCRIPTION(s) const char *pa__get_description(void) { r=
eturn s; }
+#define PA_MODULE_USAGE(s) const char *pa__get_usage(void) { return s; }
#define PA_MODULE_VERSION(s) const char * pa__get_version(void) { return s=
; }
=
pa_modinfo *pa_module_get_info(pa_module *m);
More information about the pulseaudio-commits
mailing list