summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/core.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-01-29 16:25:29 +0100
committerLennart Poettering <lennart@poettering.net>2009-01-29 16:25:29 +0100
commit746dc2ac19950d4eecc083929d6ed86443e3a112 (patch)
tree558d6fa8052ca28f3f6af7d8ccf7b5fbca7a7570 /src/pulsecore/core.c
parent4a06af6081c0fc081ad6ca136880a61ebe1c4e01 (diff)
get rid of nonsensical late initialization of namereg/scache and things
Diffstat (limited to 'src/pulsecore/core.c')
-rw-r--r--src/pulsecore/core.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c
index 689fc8f8..5fd2bdfb 100644
--- a/src/pulsecore/core.c
+++ b/src/pulsecore/core.c
@@ -92,21 +92,22 @@ pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size) {
c->state = PA_CORE_STARTUP;
c->mainloop = m;
+
c->clients = pa_idxset_new(NULL, NULL);
+ c->cards = pa_idxset_new(NULL, NULL);
c->sinks = pa_idxset_new(NULL, NULL);
c->sources = pa_idxset_new(NULL, NULL);
- c->source_outputs = pa_idxset_new(NULL, NULL);
c->sink_inputs = pa_idxset_new(NULL, NULL);
- c->cards = pa_idxset_new(NULL, NULL);
+ c->source_outputs = pa_idxset_new(NULL, NULL);
+ c->modules = pa_idxset_new(NULL, NULL);
+ c->scache = pa_idxset_new(NULL, NULL);
+
+ c->namereg = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ c->shared = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
c->default_source = NULL;
c->default_sink = NULL;
- c->modules = NULL;
- c->namereg = NULL;
- c->scache = NULL;
- c->running_as_daemon = FALSE;
-
c->default_sample_spec.format = PA_SAMPLE_S16NE;
c->default_sample_spec.rate = 44100;
c->default_sample_spec.channels = 2;
@@ -128,22 +129,20 @@ pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size) {
c->exit_idle_time = -1;
c->scache_idle_time = 20;
- c->flat_volumes = TRUE;
-
- c->resample_method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 3;
+ c->flat_volumes = TRUE;
c->disallow_module_loading = FALSE;
c->disallow_exit = FALSE;
+ c->running_as_daemon = FALSE;
c->realtime_scheduling = FALSE;
c->realtime_priority = 5;
c->disable_remixing = FALSE;
c->disable_lfe_remixing = FALSE;
+ c->resample_method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 3;
for (j = 0; j < PA_CORE_HOOK_MAX; j++)
pa_hook_init(&c->hooks[j], c);
- pa_shared_init(c);
-
pa_random(&c->cookie, sizeof(c->cookie));
#ifdef SIGPIPE
@@ -165,7 +164,13 @@ static void core_free(pa_object *o) {
c->state = PA_CORE_SHUTDOWN;
pa_module_unload_all(c);
- pa_assert(!c->modules);
+ pa_scache_free_all(c);
+
+ pa_assert(pa_idxset_isempty(c->scache));
+ pa_idxset_free(c->scache, NULL, NULL);
+
+ pa_assert(pa_idxset_isempty(c->modules));
+ pa_idxset_free(c->modules, NULL, NULL);
pa_assert(pa_idxset_isempty(c->clients));
pa_idxset_free(c->clients, NULL, NULL);
@@ -185,8 +190,12 @@ static void core_free(pa_object *o) {
pa_assert(pa_idxset_isempty(c->sink_inputs));
pa_idxset_free(c->sink_inputs, NULL, NULL);
- pa_scache_free(c);
- pa_namereg_free(c);
+ pa_assert(pa_hashmap_isempty(c->namereg));
+ pa_hashmap_free(c->namereg, NULL, NULL);
+
+ pa_assert(pa_hashmap_isempty(c->shared));
+ pa_hashmap_free(c->shared, NULL, NULL);
+
pa_subscription_free_all(c);
if (c->exit_event)
@@ -198,8 +207,6 @@ static void core_free(pa_object *o) {
pa_silence_cache_done(&c->silence_cache);
pa_mempool_free(c->mempool);
- pa_shared_cleanup(c);
-
for (j = 0; j < PA_CORE_HOOK_MAX; j++)
pa_hook_done(&c->hooks[j]);