get rid of nonsensical late initialization of namereg/scache and things

This commit is contained in:
Lennart Poettering 2009-01-29 16:25:29 +01:00
parent 4a06af6081
commit 746dc2ac19
9 changed files with 41 additions and 102 deletions

View file

@ -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->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]);