From 746dc2ac19950d4eecc083929d6ed86443e3a112 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 29 Jan 2009 16:25:29 +0100 Subject: get rid of nonsensical late initialization of namereg/scache and things --- src/pulsecore/core.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) (limited to 'src/pulsecore/core.c') 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]); -- cgit