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-scache.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'src/pulsecore/core-scache.c') diff --git a/src/pulsecore/core-scache.c b/src/pulsecore/core-scache.c index 6d2ae932..e5489415 100644 --- a/src/pulsecore/core-scache.c +++ b/src/pulsecore/core-scache.c @@ -120,9 +120,6 @@ static pa_scache_entry* scache_add_item(pa_core *c, const char *name) { e->core = c; e->proplist = pa_proplist_new(); - if (!c->scache) - c->scache = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); - pa_idxset_put(c->scache, e, &e->index); pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE|PA_SUBSCRIPTION_EVENT_NEW, e->index); @@ -287,23 +284,18 @@ int pa_scache_remove_item(pa_core *c, const char *name) { return 0; } -static void free_cb(void *p, void *userdata) { - pa_scache_entry *e = p; - pa_assert(e); - - free_entry(e); -} +void pa_scache_free_all(pa_core *c) { + pa_scache_entry *e; -void pa_scache_free(pa_core *c) { pa_assert(c); - if (c->scache) { - pa_idxset_free(c->scache, free_cb, NULL); - c->scache = NULL; - } + while ((e = pa_idxset_steal_first(c->scache, NULL))) + free_entry(e); - if (c->scache_auto_unload_event) + if (c->scache_auto_unload_event) { c->mainloop->time_free(c->scache_auto_unload_event); + c->scache_auto_unload_event = NULL; + } } int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t volume, pa_proplist *p, uint32_t *sink_input_idx) { -- cgit