summaryrefslogtreecommitdiffstats
path: root/src/modules/gconf/module-gconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/gconf/module-gconf.c')
-rw-r--r--src/modules/gconf/module-gconf.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/modules/gconf/module-gconf.c b/src/modules/gconf/module-gconf.c
index df7b1643..cbe17d20 100644
--- a/src/modules/gconf/module-gconf.c
+++ b/src/modules/gconf/module-gconf.c
@@ -4,17 +4,17 @@
This file is part of PulseAudio.
Copyright 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
@@ -80,7 +80,7 @@ struct module_info {
struct userdata {
pa_core *core;
pa_module *module;
-
+
pa_hashmap *module_infos;
pid_t pid;
@@ -129,7 +129,7 @@ static char *read_string(struct userdata *u) {
for (;;) {
char *e;
-
+
if ((e = memchr(u->buf, 0, u->buf_fill))) {
char *ret = pa_xstrdup(u->buf);
u->buf_fill -= e - u->buf +1;
@@ -149,7 +149,7 @@ static void unload_one_module(struct userdata *u, struct module_info*m, unsigned
if (m->items[i].index == PA_INVALID_INDEX)
return;
-
+
pa_log_debug("Unloading module #%i", m->items[i].index);
pa_module_unload_by_index(u->core, m->items[i].index);
m->items[i].index = PA_INVALID_INDEX;
@@ -160,7 +160,7 @@ static void unload_one_module(struct userdata *u, struct module_info*m, unsigned
static void unload_all_modules(struct userdata *u, struct module_info*m) {
unsigned i;
-
+
assert(u);
assert(m);
@@ -179,7 +179,7 @@ static void load_module(
int is_new) {
pa_module *mod;
-
+
assert(u);
assert(m);
assert(name);
@@ -193,18 +193,18 @@ static void load_module(
unload_one_module(u, m, i);
}
-
+
pa_log_debug("Loading module '%s' with args '%s' due to GConf configuration.", name, args);
m->items[i].name = pa_xstrdup(name);
m->items[i].args = pa_xstrdup(args);
m->items[i].index = PA_INVALID_INDEX;
-
+
if (!(mod = pa_module_load(u->core, name, args))) {
pa_log("pa_module_load() failed");
return;
}
-
+
m->items[i].index = mod->index;
}
@@ -227,18 +227,18 @@ static int handle_event(struct userdata *u) {
do {
if ((opcode = read_byte(u)) < 0)
goto fail;
-
+
switch (opcode) {
case '!':
/* The helper tool is now initialized */
ret = 1;
break;
-
+
case '+': {
char *name;
struct module_info *m;
unsigned i, j;
-
+
if (!(name = read_string(u)))
goto fail;
@@ -282,16 +282,16 @@ static int handle_event(struct userdata *u) {
/* Unload all removed modules */
for (j = i; j < m->n_items; j++)
unload_one_module(u, m, j);
-
+
m->n_items = i;
-
+
break;
}
-
+
case '-': {
char *name;
struct module_info *m;
-
+
if (!(name = read_string(u)))
goto fail;
@@ -301,7 +301,7 @@ static int handle_event(struct userdata *u) {
}
pa_xfree(name);
-
+
break;
}
}
@@ -324,12 +324,12 @@ static void io_event_cb(
struct userdata *u = userdata;
if (handle_event(u) < 0) {
-
+
if (u->io_event) {
u->core->mainloop->io_free(u->io_event);
u->io_event = NULL;
}
-
+
pa_module_unload_request(u->module);
}
}
@@ -342,7 +342,7 @@ static int start_client(const char *n, pid_t *pid) {
pa_log("pipe() failed: %s", pa_cstrerror(errno));
goto fail;
}
-
+
if ((child = fork()) == (pid_t) -1) {
pa_log("fork() failed: %s", pa_cstrerror(errno));
goto fail;
@@ -357,7 +357,7 @@ static int start_client(const char *n, pid_t *pid) {
return pipe_fds[0];
} else {
int max_fd, i;
-
+
/* child */
close(pipe_fds[0]);
@@ -373,7 +373,7 @@ static int start_client(const char *n, pid_t *pid) {
open("/dev/null", O_WRONLY);
max_fd = 1024;
-
+
#ifdef HAVE_SYS_RESOURCE_H
{
struct rlimit r;
@@ -381,7 +381,7 @@ static int start_client(const char *n, pid_t *pid) {
max_fd = r.rlim_max;
}
#endif
-
+
for (i = 3; i < max_fd; i++)
close(i);
@@ -402,14 +402,14 @@ static int start_client(const char *n, pid_t *pid) {
execl(n, n, NULL);
_exit(1);
}
-
+
fail:
if (pipe_fds[0] >= 0)
close(pipe_fds[0]);
if (pipe_fds[1] >= 0)
close(pipe_fds[1]);
-
+
return -1;
}
@@ -427,17 +427,17 @@ int pa__init(pa_core *c, pa_module*m) {
u->fd_type = 0;
u->io_event = NULL;
u->buf_fill = 0;
-
+
if ((u->fd = start_client(PA_GCONF_HELPER, &u->pid)) < 0)
goto fail;
-
+
u->io_event = c->mainloop->io_new(
c->mainloop,
u->fd,
PA_IO_EVENT_INPUT,
io_event_cb,
u);
-
+
do {
if ((r = handle_event(u)) < 0)
goto fail;
@@ -445,7 +445,7 @@ int pa__init(pa_core *c, pa_module*m) {
/* Read until the client signalled us that it is ready with
* initialization */
} while (r != 1);
-
+
return 0;
fail: