pa_assert(ps);
if (ps->paths)
- pa_hashmap_free(ps->paths, NULL, NULL);
+ pa_hashmap_free(ps->paths, NULL);
pa_xfree(ps);
}
void pa_alsa_profile_set_free(pa_alsa_profile_set *ps) {
pa_assert(ps);
- if (ps->input_paths) {
- pa_alsa_path *p;
-
- while ((p = pa_hashmap_steal_first(ps->input_paths)))
- pa_alsa_path_free(p);
-
- pa_hashmap_free(ps->input_paths, NULL, NULL);
- }
-
- if (ps->output_paths) {
- pa_alsa_path *p;
-
- while ((p = pa_hashmap_steal_first(ps->output_paths)))
- pa_alsa_path_free(p);
-
- pa_hashmap_free(ps->output_paths, NULL, NULL);
- }
+ if (ps->input_paths)
+ pa_hashmap_free(ps->input_paths, (pa_free_cb_t) pa_alsa_path_free);
- if (ps->profiles) {
- pa_alsa_profile *p;
+ if (ps->output_paths)
+ pa_hashmap_free(ps->output_paths, (pa_free_cb_t) pa_alsa_path_free);
- while ((p = pa_hashmap_steal_first(ps->profiles)))
- profile_free(p);
-
- pa_hashmap_free(ps->profiles, NULL, NULL);
- }
+ if (ps->profiles)
+ pa_hashmap_free(ps->profiles, (pa_free_cb_t) profile_free);
- if (ps->mappings) {
- pa_alsa_mapping *m;
-
- while ((m = pa_hashmap_steal_first(ps->mappings)))
- mapping_free(m);
+ if (ps->mappings)
+ pa_hashmap_free(ps->mappings, (pa_free_cb_t) mapping_free);
- pa_hashmap_free(ps->mappings, NULL, NULL);
- }
-
- if (ps->decibel_fixes) {
- pa_alsa_decibel_fix *db_fix;
-
- while ((db_fix = pa_hashmap_steal_first(ps->decibel_fixes)))
- decibel_fix_free(db_fix);
-
- pa_hashmap_free(ps->decibel_fixes, NULL, NULL);
- }
+ if (ps->decibel_fixes)
+ pa_hashmap_free(ps->decibel_fixes, (pa_free_cb_t) decibel_fix_free);
pa_xfree(ps);
}
paths_drop_unsupported(ps->input_paths);
paths_drop_unsupported(ps->output_paths);
- pa_hashmap_free(broken_inputs, NULL, NULL);
- pa_hashmap_free(broken_outputs, NULL, NULL);
+ pa_hashmap_free(broken_inputs, NULL);
+ pa_hashmap_free(broken_outputs, NULL);
ps->probed = TRUE;
}
if (u->mixer_handle)
snd_mixer_close(u->mixer_handle);
if (u->jacks)
- pa_hashmap_free(u->jacks, NULL, NULL);
+ pa_hashmap_free(u->jacks, NULL);
if (u->card && u->card->sinks) {
pa_sink *s;
if (y->devices) {
remove_all_devices(y);
- pa_hashmap_free(y->devices, NULL, NULL);
+ pa_hashmap_free(y->devices, NULL);
}
if (y->transports) {
pa_assert(pa_hashmap_isempty(y->transports));
- pa_hashmap_free(y->transports, NULL, NULL);
+ pa_hashmap_free(y->transports, NULL);
}
if (y->connection) {
pa_xfree(mi);
}
- pa_hashmap_free(u->hashmap, NULL, NULL);
+ pa_hashmap_free(u->hashmap, NULL);
}
if (u->modargs)
if (!(u = m->userdata))
return;
- if (u->bondings) {
- struct bonding *b;
-
- while ((b = pa_hashmap_steal_first(u->bondings)))
- bonding_free(b);
-
- pa_hashmap_free(u->bondings, NULL, NULL);
- }
+ if (u->bondings)
+ pa_hashmap_free(u->bondings, (pa_free_cb_t) bonding_free);
if (u->dbus_connection) {
update_matches(u, false);
return c;
}
-static void profile_free_cb(void *p, void *userdata) {
- pa_dbusiface_card_profile *profile = p;
-
- pa_assert(profile);
-
- pa_dbusiface_card_profile_free(profile);
-}
-
void pa_dbusiface_card_free(pa_dbusiface_card *c) {
pa_assert(c);
pa_hook_slot_free(c->card_profile_added_slot);
- pa_hashmap_free(c->profiles, profile_free_cb, NULL);
+ pa_hashmap_free(c->profiles, (pa_free_cb_t) pa_dbusiface_card_profile_free);
pa_proplist_free(c->proplist);
pa_dbus_protocol_unref(c->dbus_protocol);
pa_subscription_free(c->subscription);
return c;
}
-static void free_card_cb(void *p, void *userdata) {
- pa_dbusiface_card *c = p;
-
- pa_assert(c);
-
- pa_dbusiface_card_free(c);
-}
-
-static void free_device_cb(void *p, void *userdata) {
- pa_dbusiface_device *d = p;
-
- pa_assert(d);
-
- pa_dbusiface_device_free(d);
-}
-
-static void free_stream_cb(void *p, void *userdata) {
- pa_dbusiface_stream *s = p;
-
- pa_assert(s);
-
- pa_dbusiface_stream_free(s);
-}
-
-static void free_sample_cb(void *p, void *userdata) {
- pa_dbusiface_sample *s = p;
-
- pa_assert(s);
-
- pa_dbusiface_sample_free(s);
-}
-
-static void free_module_cb(void *p, void *userdata) {
- pa_dbusiface_module *m = p;
-
- pa_assert(m);
-
- pa_dbusiface_module_free(m);
-}
-
-static void free_client_cb(void *p, void *userdata) {
- pa_dbusiface_client *c = p;
-
- pa_assert(c);
-
- pa_dbusiface_client_free(c);
-}
-
void pa_dbusiface_core_free(pa_dbusiface_core *c) {
pa_assert(c);
/* Note that the order of freeing is important below.
* Do not change it for the sake of tidiness without checking! */
pa_subscription_free(c->subscription);
- pa_hashmap_free(c->cards, free_card_cb, NULL);
- pa_hashmap_free(c->sinks_by_path, NULL, NULL);
- pa_hashmap_free(c->sinks_by_index, free_device_cb, NULL);
- pa_hashmap_free(c->sources_by_path, NULL, NULL);
- pa_hashmap_free(c->sources_by_index, free_device_cb, NULL);
- pa_hashmap_free(c->playback_streams, free_stream_cb, NULL);
- pa_hashmap_free(c->record_streams, free_stream_cb, NULL);
- pa_hashmap_free(c->samples, free_sample_cb, NULL);
- pa_hashmap_free(c->modules, free_module_cb, NULL);
- pa_hashmap_free(c->clients, free_client_cb, NULL);
+ pa_hashmap_free(c->cards, (pa_free_cb_t) pa_dbusiface_card_free);
+ pa_hashmap_free(c->sinks_by_path, NULL);
+ pa_hashmap_free(c->sinks_by_index, (pa_free_cb_t) pa_dbusiface_device_free);
+ pa_hashmap_free(c->sources_by_path, NULL);
+ pa_hashmap_free(c->sources_by_index, (pa_free_cb_t) pa_dbusiface_device_free);
+ pa_hashmap_free(c->playback_streams, (pa_free_cb_t) pa_dbusiface_stream_free);
+ pa_hashmap_free(c->record_streams, (pa_free_cb_t) pa_dbusiface_stream_free);
+ pa_hashmap_free(c->samples, (pa_free_cb_t) pa_dbusiface_sample_free);
+ pa_hashmap_free(c->modules, (pa_free_cb_t) pa_dbusiface_module_free);
+ pa_hashmap_free(c->clients, (pa_free_cb_t) pa_dbusiface_client_free);
pa_hook_slot_free(c->sink_put_slot);
pa_hook_slot_free(c->sink_unlink_slot);
pa_hook_slot_free(c->source_put_slot);
return d;
}
-static void port_free_cb(void *p, void *userdata) {
- pa_dbusiface_device_port *port = p;
-
- pa_assert(port);
-
- pa_dbusiface_device_port_free(port);
-}
-
void pa_dbusiface_device_free(pa_dbusiface_device *d) {
pa_assert(d);
pa_assert_se(pa_dbus_protocol_remove_interface(d->dbus_protocol, d->path, source_interface_info.name) >= 0);
pa_source_unref(d->source);
}
- pa_hashmap_free(d->ports, port_free_cb, NULL);
+ pa_hashmap_free(d->ports, (pa_free_cb_t) pa_dbusiface_device_port_free);
pa_proplist_free(d->proplist);
pa_dbus_protocol_unref(d->dbus_protocol);
pa_subscription_free(d->subscription);
m->items[i].index = mod->index;
}
-static void module_info_free(void *p, void *userdata) {
+static void module_info_free(void *p) {
struct module_info *m = p;
pa_assert(m);
if ((m = pa_hashmap_get(u->module_infos, name))) {
pa_hashmap_remove(u->module_infos, name);
- module_info_free(m, u);
+ module_info_free(m);
}
pa_xfree(name);
pa_close(u->fd);
if (u->module_infos)
- pa_hashmap_free(u->module_infos, module_info_free, NULL);
+ pa_hashmap_free(u->module_infos, (pa_free_cb_t) module_info_free);
pa_xfree(u);
}
unpublish_all_services(u);
if (u->services)
- pa_hashmap_free(u->services, NULL, NULL);
+ pa_hashmap_free(u->services, NULL);
if (u->sink_new_slot)
pa_hook_slot_free(u->sink_new_slot);
if (u->client_proplist_changed_slot)
pa_hook_slot_free(u->client_proplist_changed_slot);
- if (u->cache) {
- struct rule *r;
-
- while ((r = pa_hashmap_steal_first(u->cache)))
- rule_free(r);
-
- pa_hashmap_free(u->cache, NULL, NULL);
- }
+ if (u->cache)
+ pa_hashmap_free(u->cache, (pa_free_cb_t) rule_free);
pa_xfree(u);
}
p_info->offset = port->latency_offset;
}
-static void port_info_free(struct port_info *p_info, void *userdata) {
+static void port_info_free(struct port_info *p_info) {
pa_assert(p_info);
pa_xfree(p_info->name);
pa_assert(e);
pa_xfree(e->profile);
- pa_hashmap_free(e->ports, (pa_free2_cb_t) port_info_free, NULL);
+ pa_hashmap_free(e->ports, (pa_free_cb_t) port_info_free);
pa_xfree(e);
}
void pa__done(pa_module *m) {
struct userdata *u;
- struct session *session;
pa_assert(m);
if (!(u = m->userdata))
return;
- if (u->sessions) {
- while ((session = pa_hashmap_steal_first(u->sessions)))
- free_session(session);
-
- pa_hashmap_free(u->sessions, NULL, NULL);
- }
+ if (u->sessions)
+ pa_hashmap_free(u->sessions, (pa_free_cb_t) free_session);
if (u->connection) {
pa_dbus_remove_matches(
pa_xfree(device);
}
- pa_hashmap_free(h, NULL, NULL);
+ pa_hashmap_free(h, NULL);
pa_log_error("Protocol error on reorder");
goto fail;
}
pa_xfree(device);
}
- pa_hashmap_free(h, NULL, NULL);
+ pa_hashmap_free(h, NULL);
pa_log_error("Client specified an unknown device in it's reorder list.");
goto fail;
}
pa_xfree(device);
}
- pa_hashmap_free(h, NULL, NULL);
+ pa_hashmap_free(h, NULL);
pa_log_error("Attempted to reorder mixed devices (sinks and sources)");
goto fail;
}
while ((device = pa_hashmap_steal_first(h))) {
devices[idx++] = device;
}
- pa_hashmap_free(h, NULL, NULL);
+ pa_hashmap_free(h, NULL);
/* Simple bubble sort */
for (i = 0; i < n_devices; ++i) {
filter_free(f);
}
- pa_hashmap_free(u->filters, NULL, NULL);
+ pa_hashmap_free(u->filters, NULL);
}
pa_xfree(u);
pa_hook_slot_free(u->sink_input_move_finish_slot);
if (u->cork_state)
- pa_hashmap_free(u->cork_state, NULL, NULL);
+ pa_hashmap_free(u->cork_state, NULL);
pa_xfree(u);
return -1;
}
-#ifdef HAVE_DBUS
-static void free_dbus_entry_cb(void *p, void *userdata) {
- struct dbus_entry *de = p;
-
- pa_assert(de);
-
- dbus_entry_free(de);
-}
-#endif
-
void pa__done(pa_module*m) {
struct userdata* u;
pa_assert_se(pa_dbus_protocol_unregister_extension(u->dbus_protocol, INTERFACE_STREAM_RESTORE) >= 0);
pa_assert_se(pa_dbus_protocol_remove_interface(u->dbus_protocol, OBJECT_PATH, stream_restore_interface_info.name) >= 0);
- pa_hashmap_free(u->dbus_entries, free_dbus_entry_cb, NULL);
+ pa_hashmap_free(u->dbus_entries, (pa_free_cb_t) dbus_entry_free);
pa_dbus_protocol_unref(u->dbus_protocol);
}
void pa__done(pa_module*m) {
struct userdata *u;
- struct device_info *d;
pa_assert(m);
if (u->source_output_state_changed_slot)
pa_hook_slot_free(u->source_output_state_changed_slot);
- while ((d = pa_hashmap_steal_first(u->device_infos)))
- device_info_free(d);
-
- pa_hashmap_free(u->device_infos, NULL, NULL);
+ pa_hashmap_free(u->device_infos, (pa_free_cb_t) device_info_free);
pa_xfree(u);
}
return;
if (u->sessions) {
- while ((session = pa_hashmap_steal_first(u->sessions)))
- free_session(session);
-
- pa_hashmap_free(u->sessions, NULL, NULL);
-
- while ((session = pa_hashmap_steal_first(u->previous_sessions)))
- free_session(session);
-
- pa_hashmap_free(u->previous_sessions, NULL, NULL);
+ pa_hashmap_free(u->sessions, (pa_free_cb_t) free_session);
+ pa_hashmap_free(u->previous_sessions, (pa_free_cb_t) free_session);
}
if (u->io)
if (u->inotify_fd >= 0)
pa_close(u->inotify_fd);
- if (u->devices) {
- struct device *d;
-
- while ((d = pa_hashmap_steal_first(u->devices)))
- device_free(d);
-
- pa_hashmap_free(u->devices, NULL, NULL);
- }
+ if (u->devices)
+ pa_hashmap_free(u->devices, (pa_free_cb_t) device_free);
pa_xfree(u);
}
tunnel_free(t);
}
- pa_hashmap_free(u->tunnels, NULL, NULL);
+ pa_hashmap_free(u->tunnels, NULL);
}
pa_xfree(u);
finish:
/* Remove this service */
- if (r < 0)
+ if (r < 0) {
+ pa_hashmap_remove(s->userdata->services, s->device);
service_free(s);
+ }
avahi_string_list_free(txt);
static void service_free(struct service *s) {
pa_assert(s);
- pa_hashmap_remove(s->userdata->services, s->device);
-
if (s->entry_group) {
pa_log_debug("Removing entry group for %s.", s->service_name);
avahi_entry_group_free(s->entry_group);
pa_assert(c);
pa_object_assert_ref(o);
- if ((s = pa_hashmap_get(u->services, o)))
+ if ((s = pa_hashmap_remove(u->services, o)))
service_free(s);
return PA_HOOK_OK;
if (!(u = m->userdata))
return;
- if (u->services) {
- struct service *s;
-
- while ((s = pa_hashmap_first(u->services)))
- service_free(s);
-
- pa_hashmap_free(u->services, NULL, NULL);
- }
+ if (u->services)
+ pa_hashmap_free(u->services, (pa_free_cb_t) service_free);
if (u->sink_new_slot)
pa_hook_slot_free(u->sink_new_slot);
tunnel_free(t);
}
- pa_hashmap_free(u->tunnels, NULL, NULL);
+ pa_hashmap_free(u->tunnels, NULL);
}
pa_xfree(u);
}
void pa_headerlist_free(pa_headerlist* p) {
- struct header *hdr;
-
- while ((hdr = pa_hashmap_steal_first(MAKE_HASHMAP(p))))
- header_free(hdr);
-
- pa_hashmap_free(MAKE_HASHMAP(p), NULL, NULL);
+ pa_hashmap_free(MAKE_HASHMAP(p), (pa_free_cb_t) header_free);
}
int pa_headerlist_puts(pa_headerlist *p, const char *key, const char *value) {
pa_sink_input_assert_ref(i);
pa_assert_se(s = i->userdata);
+ pa_hashmap_remove(s->userdata->by_origin, s->sdp_info.origin);
session_free(s);
}
PA_LLIST_REMOVE(struct session, s->userdata->sessions, s);
pa_assert(s->userdata->n_sessions >= 1);
s->userdata->n_sessions--;
- pa_hashmap_remove(s->userdata->by_origin, s->sdp_info.origin);
pa_memblockq_free(s->memblockq);
pa_sdp_info_destroy(&s->sdp_info);
if (goodbye) {
- if ((s = pa_hashmap_get(u->by_origin, info.origin)))
+ if ((s = pa_hashmap_remove(u->by_origin, info.origin)))
session_free(s);
pa_sdp_info_destroy(&info);
k = pa_atomic_load(&s->timestamp);
- if (k + DEATH_TIMEOUT < now.tv_sec)
+ if (k + DEATH_TIMEOUT < now.tv_sec) {
+ pa_hashmap_remove(u->by_origin, s->sdp_info.origin);
session_free(s);
+ }
}
/* Restart timer */
void pa__done(pa_module*m) {
struct userdata *u;
- struct session *s;
pa_assert(m);
pa_sap_context_destroy(&u->sap_context);
- if (u->by_origin) {
- while ((s = pa_hashmap_first(u->by_origin)))
- session_free(s);
-
- pa_hashmap_free(u->by_origin, NULL, NULL);
- }
+ if (u->by_origin)
+ pa_hashmap_free(u->by_origin, (pa_free_cb_t) session_free);
pa_xfree(u->sink_name);
pa_xfree(u);
#endif
if (c->record_streams)
- pa_hashmap_free(c->record_streams, NULL, NULL);
+ pa_hashmap_free(c->record_streams, NULL);
if (c->playback_streams)
- pa_hashmap_free(c->playback_streams, NULL, NULL);
+ pa_hashmap_free(c->playback_streams, NULL);
if (c->mempool)
pa_mempool_free(c->mempool);
void pa_proplist_free(pa_proplist* p) {
pa_assert(p);
- pa_proplist_clear(p);
- pa_hashmap_free(MAKE_HASHMAP(p), NULL, NULL);
+ pa_hashmap_free(MAKE_HASHMAP(p), (pa_free_cb_t) property_free);
}
/** Will accept only valid UTF-8 */
void pa_card_profile_free(pa_card_profile *c) {
pa_assert(c);
- pa_assert(!c->card); /* Card profiles shouldn't be freed before removing them from the card. */
pa_xfree(c->name);
pa_xfree(c->description);
pa_proplist_free(data->proplist);
- if (data->profiles) {
- pa_card_profile *c;
-
- while ((c = pa_hashmap_steal_first(data->profiles)))
- pa_card_profile_free(c);
-
- pa_hashmap_free(data->profiles, NULL, NULL);
- }
+ if (data->profiles)
+ pa_hashmap_free(data->profiles, (pa_free_cb_t) pa_card_profile_free);
if (data->ports)
pa_device_port_hashmap_free(data->ports);
pa_device_port_hashmap_free(c->ports);
- if (c->profiles) {
- pa_card_profile *p;
-
- while ((p = pa_hashmap_steal_first(c->profiles))) {
- p->card = NULL;
- pa_card_profile_free(p);
- }
-
- pa_hashmap_free(c->profiles, NULL, NULL);
- }
+ if (c->profiles)
+ pa_hashmap_free(c->profiles, (pa_free_cb_t) pa_card_profile_free);
pa_proplist_free(c->proplist);
pa_xfree(c->driver);
pa_idxset_free(c->sink_inputs, NULL, NULL);
pa_assert(pa_hashmap_isempty(c->namereg));
- pa_hashmap_free(c->namereg, NULL, NULL);
+ pa_hashmap_free(c->namereg, NULL);
pa_assert(pa_hashmap_isempty(c->shared));
- pa_hashmap_free(c->shared, NULL, NULL);
+ pa_hashmap_free(c->shared, NULL);
pa_subscription_free_all(c);
pa_assert(db);
pa_database_sync(database);
- pa_database_clear(database);
pa_xfree(db->filename);
pa_xfree(db->tmp_filename);
- pa_hashmap_free(db->map, NULL, NULL);
+ pa_hashmap_free(db->map, (pa_free_cb_t) free_entry);
pa_xfree(db);
}
if (p->proplist)
pa_proplist_free(p->proplist);
+
if (p->profiles)
- pa_hashmap_free(p->profiles, NULL, NULL);
+ pa_hashmap_free(p->profiles, NULL);
+
pa_xfree(p->name);
pa_xfree(p->description);
pa_xfree(p);
}
void pa_device_port_hashmap_free(pa_hashmap *h) {
- pa_device_port *p;
-
pa_assert(h);
- while ((p = pa_hashmap_steal_first(h)))
- pa_device_port_unref(p);
-
- pa_hashmap_free(h, NULL, NULL);
+ pa_hashmap_free(h, (pa_free_cb_t) pa_device_port_unref);
}
void pa_device_port_set_latency_offset(pa_device_port *p, int64_t offset) {
h->n_entries--;
}
-void pa_hashmap_free(pa_hashmap*h, pa_free2_cb_t free_cb, void *userdata) {
+void pa_hashmap_free(pa_hashmap *h, pa_free_cb_t free_cb) {
pa_assert(h);
while (h->iterate_list_head) {
remove_entry(h, h->iterate_list_head);
if (free_cb)
- free_cb(data, userdata);
+ free_cb(data);
}
pa_xfree(h);
USA.
***/
+#include <pulse/def.h>
+
#include <pulsecore/idxset.h>
/* Simple Implementation of a hash table. Memory management is the
pa_hashmap *pa_hashmap_new(pa_hash_func_t hash_func, pa_compare_func_t compare_func);
/* Free the hash table. Calls the specified function for every value in the table. The function may be NULL */
-void pa_hashmap_free(pa_hashmap*, pa_free2_cb_t free_cb, void *userdata);
+void pa_hashmap_free(pa_hashmap*, pa_free_cb_t free_cb);
/* Add an entry to the hashmap. Returns non-zero when the entry already exists */
int pa_hashmap_put(pa_hashmap *h, const void *key, void *value);
pa_mutex_unlock(i->pool->mutex);
- pa_hashmap_free(i->blocks, NULL, NULL);
- pa_hashmap_free(i->segments, NULL, NULL);
+ pa_hashmap_free(i->blocks, NULL);
+ pa_hashmap_free(i->segments, NULL);
pa_mutex_free(i->mutex);
return NULL;
}
-static void free_func(void *p, void*userdata) {
+static void free_func(void *p) {
struct entry *e = p;
pa_assert(e);
void pa_modargs_free(pa_modargs*ma) {
pa_assert(ma);
- pa_hashmap_free(ma->raw, free_func, NULL);
- pa_hashmap_free(ma->unescaped, free_func, NULL);
+ pa_hashmap_free(ma->raw, free_func);
+ pa_hashmap_free(ma->unescaped, free_func);
pa_xfree(ma);
}
void pa_cond_free(pa_cond *c) {
assert(c);
- pa_hashmap_free(c->wait_events, NULL, NULL);
+ pa_hashmap_free(c->wait_events, NULL);
pa_xfree(c);
}
pa_assert(pa_hashmap_isempty(p->connections));
pa_assert(pa_idxset_isempty(p->extensions));
- pa_hashmap_free(p->objects, NULL, NULL);
- pa_hashmap_free(p->connections, NULL, NULL);
+ pa_hashmap_free(p->objects, NULL);
+ pa_hashmap_free(p->connections, NULL);
pa_idxset_free(p->extensions, NULL, NULL);
for (i = 0; i < PA_DBUS_PROTOCOL_HOOK_MAX; ++i)
pa_assert_se(dbus_connection_unregister_object_path(conn_entry->connection, obj_entry->path));
}
-static void method_handler_free_cb(void *p, void *userdata) {
- pa_dbus_method_handler *h = p;
+static void method_handler_free(pa_dbus_method_handler *h) {
unsigned i;
pa_assert(h);
pa_xfree(h);
}
-static void method_signature_free_cb(void *p, void *userdata) {
- pa_assert(p);
-
- pa_xfree(p);
-}
-
-static void property_handler_free_cb(void *p, void *userdata) {
- pa_dbus_property_handler *h = p;
-
+static void property_handler_free(pa_dbus_property_handler *h) {
pa_assert(h);
pa_xfree((char *) h->property_name);
pa_log_debug("Interface %s removed from object %s", iface_entry->name, obj_entry->path);
pa_xfree(iface_entry->name);
- pa_hashmap_free(iface_entry->method_signatures, method_signature_free_cb, NULL);
- pa_hashmap_free(iface_entry->method_handlers, method_handler_free_cb, NULL);
- pa_hashmap_free(iface_entry->property_handlers, property_handler_free_cb, NULL);
+ pa_hashmap_free(iface_entry->method_signatures, pa_xfree);
+ pa_hashmap_free(iface_entry->method_handlers, (pa_free_cb_t) method_handler_free);
+ pa_hashmap_free(iface_entry->property_handlers, (pa_free_cb_t) property_handler_free);
for (i = 0; i < iface_entry->n_signals; ++i) {
unsigned j;
pa_hashmap_remove(p->objects, path);
pa_xfree(obj_entry->path);
- pa_hashmap_free(obj_entry->interfaces, NULL, NULL);
+ pa_hashmap_free(obj_entry->interfaces, NULL);
pa_xfree(obj_entry->introspection);
pa_xfree(obj_entry);
}
int pa_dbus_protocol_unregister_connection(pa_dbus_protocol *p, DBusConnection *conn) {
struct connection_entry *conn_entry = NULL;
- struct signal_paths_entry *signal_paths_entry = NULL;
char *object_path = NULL;
pa_assert(p);
pa_idxset_free(conn_entry->all_signals_objects, NULL, NULL);
- while ((signal_paths_entry = pa_hashmap_steal_first(conn_entry->listening_signals)))
- signal_paths_entry_free(signal_paths_entry);
-
- pa_hashmap_free(conn_entry->listening_signals, NULL, NULL);
+ pa_hashmap_free(conn_entry->listening_signals, (pa_free_cb_t) signal_paths_entry_free);
pa_xfree(conn_entry);
return 0;
for (h = 0; h < PA_NATIVE_HOOK_MAX; h++)
pa_hook_done(&p->hooks[h]);
- pa_hashmap_free(p->extensions, NULL, NULL);
+ pa_hashmap_free(p->extensions, NULL);
pa_assert_se(pa_shared_remove(p->core, "native-protocol") >= 0);
pa_xfree(volume_entry);
}
-static void volume_factor_entry_free2(struct volume_factor_entry *volume_entry, void *userdarta) {
- volume_factor_entry_free(volume_entry);
-}
-
static void volume_factor_from_hashmap(pa_cvolume *v, pa_hashmap *items, uint8_t channels) {
struct volume_factor_entry *entry;
void *state = NULL;
pa_format_info_free(data->format);
if (data->volume_factor_items)
- pa_hashmap_free(data->volume_factor_items, (pa_free2_cb_t) volume_factor_entry_free2, NULL);
+ pa_hashmap_free(data->volume_factor_items, (pa_free_cb_t) volume_factor_entry_free);
if (data->volume_factor_sink_items)
- pa_hashmap_free(data->volume_factor_sink_items, (pa_free2_cb_t) volume_factor_entry_free2, NULL);
+ pa_hashmap_free(data->volume_factor_sink_items, (pa_free_cb_t) volume_factor_entry_free);
pa_proplist_free(data->proplist);
}
pa_idxset_free(i->direct_outputs, NULL, NULL);
if (i->thread_info.direct_outputs)
- pa_hashmap_free(i->thread_info.direct_outputs, NULL, NULL);
+ pa_hashmap_free(i->thread_info.direct_outputs, NULL);
if (i->volume_factor_items)
- pa_hashmap_free(i->volume_factor_items, (pa_free2_cb_t) volume_factor_entry_free2, NULL);
+ pa_hashmap_free(i->volume_factor_items, (pa_free_cb_t) volume_factor_entry_free);
+
if (i->volume_factor_sink_items)
- pa_hashmap_free(i->volume_factor_sink_items, (pa_free2_cb_t) volume_factor_entry_free2, NULL);
+ pa_hashmap_free(i->volume_factor_sink_items, (pa_free_cb_t) volume_factor_entry_free);
pa_xfree(i->driver);
pa_xfree(i);
/* Called from main context */
static void sink_free(pa_object *o) {
pa_sink *s = PA_SINK(o);
- pa_sink_input *i;
pa_assert(s);
pa_assert_ctl_context();
}
pa_idxset_free(s->inputs, NULL, NULL);
-
- while ((i = pa_hashmap_steal_first(s->thread_info.inputs)))
- pa_sink_input_unref(i);
-
- pa_hashmap_free(s->thread_info.inputs, NULL, NULL);
+ pa_hashmap_free(s->thread_info.inputs, (pa_free_cb_t) pa_sink_input_unref);
if (s->silence.memblock)
pa_memblock_unref(s->silence.memblock);
/* Called from main context */
static void source_free(pa_object *o) {
- pa_source_output *so;
pa_source *s = PA_SOURCE(o);
pa_assert(s);
pa_log_info("Freeing source %u \"%s\"", s->index, s->name);
pa_idxset_free(s->outputs, NULL, NULL);
-
- while ((so = pa_hashmap_steal_first(s->thread_info.outputs)))
- pa_source_output_unref(so);
-
- pa_hashmap_free(s->thread_info.outputs, NULL, NULL);
+ pa_hashmap_free(s->thread_info.outputs, (pa_free_cb_t) pa_source_output_unref);
if (s->silence.memblock)
pa_memblock_unref(s->silence.memblock);