pa_assert(ps);
if (ps->paths)
- pa_hashmap_free(ps->paths, NULL);
+ pa_hashmap_free(ps->paths);
pa_xfree(ps);
}
pa_assert(ps);
if (ps->input_paths)
- pa_hashmap_free(ps->input_paths, (pa_free_cb_t) pa_alsa_path_free);
+ pa_hashmap_free(ps->input_paths);
if (ps->output_paths)
- pa_hashmap_free(ps->output_paths, (pa_free_cb_t) pa_alsa_path_free);
+ pa_hashmap_free(ps->output_paths);
if (ps->profiles)
- pa_hashmap_free(ps->profiles, (pa_free_cb_t) profile_free);
+ pa_hashmap_free(ps->profiles);
if (ps->mappings)
- pa_hashmap_free(ps->mappings, (pa_free_cb_t) mapping_free);
+ pa_hashmap_free(ps->mappings);
if (ps->decibel_fixes)
- pa_hashmap_free(ps->decibel_fixes, (pa_free_cb_t) decibel_fix_free);
+ pa_hashmap_free(ps->decibel_fixes);
pa_xfree(ps);
}
mixer_handle = pa_alsa_open_mixer_for_pcm(pcm_handle, NULL, &hctl_handle);
if (!mixer_handle || !hctl_handle) {
/* Cannot open mixer, remove all entries */
- pa_hashmap_remove_all(ps->paths, NULL);
+ pa_hashmap_remove_all(ps->paths);
return;
}
};
ps = pa_xnew0(pa_alsa_profile_set, 1);
- ps->mappings = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
- ps->profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
- ps->decibel_fixes = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
- ps->input_paths = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
- ps->output_paths = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ ps->mappings = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) mapping_free);
+ ps->profiles = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) profile_free);
+ ps->decibel_fixes = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) decibel_fix_free);
+ ps->input_paths = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) pa_alsa_path_free);
+ ps->output_paths = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) pa_alsa_path_free);
items[0].data = &ps->auto_profiles;
paths_drop_unsupported(ps->input_paths);
paths_drop_unsupported(ps->output_paths);
- pa_hashmap_free(broken_inputs, NULL);
- pa_hashmap_free(broken_outputs, NULL);
+ pa_hashmap_free(broken_inputs);
+ pa_hashmap_free(broken_outputs);
ps->probed = true;
}
if (u->mixer_handle)
snd_mixer_close(u->mixer_handle);
if (u->jacks)
- pa_hashmap_free(u->jacks, NULL);
+ pa_hashmap_free(u->jacks);
if (u->card && u->card->sinks)
pa_idxset_remove_all(u->card->sinks, (pa_free_cb_t) pa_alsa_sink_free);
if (y->devices) {
remove_all_devices(y);
- pa_hashmap_free(y->devices, NULL);
+ pa_hashmap_free(y->devices);
}
if (y->transports) {
pa_assert(pa_hashmap_isempty(y->transports));
- pa_hashmap_free(y->transports, NULL);
+ pa_hashmap_free(y->transports);
}
if (y->connection) {
pa_xfree(mi);
}
- pa_hashmap_free(u->hashmap, NULL);
+ pa_hashmap_free(u->hashmap);
}
if (u->modargs)
u->sink_name = pa_xstrdup(pa_modargs_get_value(ma, "sink", NULL));
u->hci = pa_xstrdup(pa_modargs_get_value(ma, "hci", DEFAULT_HCI));
u->hci_path = pa_sprintf_malloc("/org/bluez/%s", u->hci);
- u->bondings = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ u->bondings = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) bonding_free);
if (!(u->dbus_connection = pa_dbus_bus_get(m->core, DBUS_BUS_SYSTEM, &e))) {
pa_log("Failed to get D-Bus connection: %s", e.message);
return;
if (u->bondings)
- pa_hashmap_free(u->bondings, (pa_free_cb_t) bonding_free);
+ pa_hashmap_free(u->bondings);
if (u->dbus_connection) {
update_matches(u, false);
return PA_HOOK_OK;
p = pa_dbusiface_card_profile_new(c, core, profile, c->next_profile_index++);
- pa_assert_se(pa_hashmap_put(c->profiles, pa_dbusiface_card_profile_get_name(p), p) >= 0);
+ pa_assert_se(pa_hashmap_put(c->profiles, (char *) pa_dbusiface_card_profile_get_name(p), p) >= 0);
/* Send D-Bus signal */
object_path = pa_dbusiface_card_profile_get_path(p);
c->core = core;
c->card = card;
c->path = pa_sprintf_malloc("%s/%s%u", PA_DBUS_CORE_OBJECT_PATH, OBJECT_NAME, card->index);
- c->profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ c->profiles = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL,
+ (pa_free_cb_t) pa_dbusiface_card_profile_free);
c->next_profile_index = 0;
c->active_profile = card->active_profile;
c->proplist = pa_proplist_copy(card->proplist);
PA_HASHMAP_FOREACH(profile, card->profiles, state) {
pa_dbusiface_card_profile *p = pa_dbusiface_card_profile_new(c, card->core, profile, c->next_profile_index++);
- pa_hashmap_put(c->profiles, pa_dbusiface_card_profile_get_name(p), p);
+ pa_hashmap_put(c->profiles, (char *) pa_dbusiface_card_profile_get_name(p), p);
}
pa_assert_se(pa_dbus_protocol_add_interface(c->dbus_protocol, c->path, &card_interface_info, c) >= 0);
pa_hook_slot_free(c->card_profile_added_slot);
- pa_hashmap_free(c->profiles, (pa_free_cb_t) pa_dbusiface_card_profile_free);
+ pa_hashmap_free(c->profiles);
pa_proplist_free(c->proplist);
pa_dbus_protocol_unref(c->dbus_protocol);
pa_subscription_free(c->subscription);
object_path = pa_dbusiface_device_get_path(d);
pa_assert_se(pa_hashmap_put(c->sinks_by_index, PA_UINT32_TO_PTR(s->index), d) >= 0);
- pa_assert_se(pa_hashmap_put(c->sinks_by_path, object_path, d) >= 0);
+ pa_assert_se(pa_hashmap_put(c->sinks_by_path, (char *) object_path, d) >= 0);
pa_assert_se(signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
PA_DBUS_CORE_INTERFACE,
object_path = pa_dbusiface_device_get_path(d);
pa_assert_se(pa_hashmap_put(c->sources_by_index, PA_UINT32_TO_PTR(s->index), d) >= 0);
- pa_assert_se(pa_hashmap_put(c->sources_by_path, object_path, d) >= 0);
+ pa_assert_se(pa_hashmap_put(c->sources_by_path, (char *) object_path, d) >= 0);
pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
PA_DBUS_CORE_INTERFACE,
c->core = core;
c->subscription = pa_subscription_new(core, PA_SUBSCRIPTION_MASK_ALL, subscription_cb, c);
c->dbus_protocol = pa_dbus_protocol_get(core);
- c->cards = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
- c->sinks_by_index = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
+ c->cards = pa_hashmap_new_full(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func, NULL, (pa_free_cb_t) pa_dbusiface_card_free);
+ c->sinks_by_index = pa_hashmap_new_full(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func, NULL,
+ (pa_free_cb_t) pa_dbusiface_device_free);
c->sinks_by_path = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
- c->sources_by_index = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
+ c->sources_by_index = pa_hashmap_new_full(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func, NULL,
+ (pa_free_cb_t) pa_dbusiface_device_free);
c->sources_by_path = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
- c->playback_streams = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
- c->record_streams = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
- c->samples = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
- c->modules = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
- c->clients = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
+ c->playback_streams = pa_hashmap_new_full(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func, NULL,
+ (pa_free_cb_t) pa_dbusiface_stream_free);
+ c->record_streams = pa_hashmap_new_full(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func, NULL,
+ (pa_free_cb_t) pa_dbusiface_stream_free);
+ c->samples = pa_hashmap_new_full(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func, NULL, (pa_free_cb_t) pa_dbusiface_sample_free);
+ c->modules = pa_hashmap_new_full(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func, NULL, (pa_free_cb_t) pa_dbusiface_module_free);
+ c->clients = pa_hashmap_new_full(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func, NULL, (pa_free_cb_t) pa_dbusiface_client_free);
c->fallback_sink = pa_namereg_get_default_sink(core);
c->fallback_source = pa_namereg_get_default_source(core);
c->sink_put_slot = pa_hook_connect(&core->hooks[PA_CORE_HOOK_SINK_PUT], PA_HOOK_NORMAL, sink_put_cb, c);
PA_IDXSET_FOREACH(sink, core->sinks, idx) {
device = pa_dbusiface_device_new_sink(c, sink);
pa_hashmap_put(c->sinks_by_index, PA_UINT32_TO_PTR(idx), device);
- pa_hashmap_put(c->sinks_by_path, pa_dbusiface_device_get_path(device), device);
+ pa_hashmap_put(c->sinks_by_path, (char *) pa_dbusiface_device_get_path(device), device);
}
PA_IDXSET_FOREACH(source, core->sources, idx) {
device = pa_dbusiface_device_new_source(c, source);
pa_hashmap_put(c->sources_by_index, PA_UINT32_TO_PTR(idx), device);
- pa_hashmap_put(c->sources_by_path, pa_dbusiface_device_get_path(device), device);
+ pa_hashmap_put(c->sources_by_path, (char *) pa_dbusiface_device_get_path(device), device);
}
PA_IDXSET_FOREACH(sink_input, core->sink_inputs, idx)
/* 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, (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_hashmap_free(c->cards);
+ pa_hashmap_free(c->sinks_by_path);
+ pa_hashmap_free(c->sinks_by_index);
+ pa_hashmap_free(c->sources_by_path);
+ pa_hashmap_free(c->sources_by_index);
+ pa_hashmap_free(c->playback_streams);
+ pa_hashmap_free(c->record_streams);
+ pa_hashmap_free(c->samples);
+ pa_hashmap_free(c->modules);
+ pa_hashmap_free(c->clients);
pa_hook_slot_free(c->sink_put_slot);
pa_hook_slot_free(c->sink_unlink_slot);
pa_hook_slot_free(c->source_put_slot);
d->volume = *pa_sink_get_volume(sink, false);
d->mute = pa_sink_get_mute(sink, false);
d->sink_state = pa_sink_get_state(sink);
- d->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ d->ports = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) pa_dbusiface_device_port_free);
d->next_port_index = 0;
d->active_port = sink->active_port;
d->proplist = pa_proplist_copy(sink->proplist);
PA_HASHMAP_FOREACH(port, sink->ports, state) {
pa_dbusiface_device_port *p = pa_dbusiface_device_port_new(d, sink->core, port, d->next_port_index++);
- pa_hashmap_put(d->ports, pa_dbusiface_device_port_get_name(p), p);
+ pa_hashmap_put(d->ports, (char *) pa_dbusiface_device_port_get_name(p), p);
}
pa_assert_se(pa_dbus_protocol_add_interface(d->dbus_protocol, d->path, &device_interface_info, d) >= 0);
PA_HASHMAP_FOREACH(port, source->ports, state) {
pa_dbusiface_device_port *p = pa_dbusiface_device_port_new(d, source->core, port, d->next_port_index++);
- pa_hashmap_put(d->ports, pa_dbusiface_device_port_get_name(p), p);
+ pa_hashmap_put(d->ports, (char *) pa_dbusiface_device_port_get_name(p), p);
}
pa_assert_se(pa_dbus_protocol_add_interface(d->dbus_protocol, d->path, &device_interface_info, d) >= 0);
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, (pa_free_cb_t) pa_dbusiface_device_port_free);
+ pa_hashmap_free(d->ports);
pa_proplist_free(d->proplist);
pa_dbus_protocol_unref(d->dbus_protocol);
pa_subscription_free(d->subscription);
u->core = m->core;
u->module = m;
m->userdata = u;
- u->module_infos = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ u->module_infos = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) module_info_free);
u->pid = (pid_t) -1;
u->fd = -1;
u->fd_type = 0;
pa_close(u->fd);
if (u->module_infos)
- pa_hashmap_free(u->module_infos, (pa_free_cb_t) module_info_free);
+ pa_hashmap_free(u->module_infos);
pa_xfree(u);
}
unpublish_all_services(u);
if (u->services)
- pa_hashmap_free(u->services, NULL);
+ pa_hashmap_free(u->services);
if (u->sink_new_slot)
pa_hook_slot_free(u->sink_new_slot);
m->userdata = u = pa_xnew(struct userdata, 1);
- u->cache = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ u->cache = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) rule_free);
u->client_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_CLIENT_NEW], PA_HOOK_EARLY, (pa_hook_cb_t) client_new_cb, u);
u->client_proplist_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_CLIENT_PROPLIST_CHANGED], PA_HOOK_EARLY, (pa_hook_cb_t) client_proplist_changed_cb, u);
pa_hook_slot_free(u->client_proplist_changed_slot);
if (u->cache)
- pa_hashmap_free(u->cache, (pa_free_cb_t) rule_free);
+ pa_hashmap_free(u->cache);
pa_xfree(u);
}
u->save_time_event = pa_core_rttime_new(u->core, pa_rtclock_now() + SAVE_INTERVAL, save_time_callback, u);
}
+static void port_info_free(struct port_info *p_info) {
+ pa_assert(p_info);
+
+ pa_xfree(p_info->name);
+ pa_xfree(p_info);
+}
+
static struct entry* entry_new(void) {
struct entry *r = pa_xnew0(struct entry, 1);
r->version = ENTRY_VERSION;
- r->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ r->ports = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) port_info_free);
return r;
}
return p_info;
}
-static void port_info_free(struct port_info *p_info) {
- pa_assert(p_info);
-
- pa_xfree(p_info->name);
- pa_xfree(p_info);
-}
-
static void entry_free(struct entry* e) {
pa_assert(e);
pa_xfree(e->profile);
- pa_hashmap_free(e->ports, (pa_free_cb_t) port_info_free);
+ pa_hashmap_free(e->ports);
pa_xfree(e);
}
u->core = m->core;
u->module = m;
u->connection = connection;
- u->sessions = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ u->sessions = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) free_session);
if (!dbus_connection_add_filter(pa_dbus_connection_get(connection), filter_cb, u, NULL)) {
pa_log_error("Failed to add filter function");
return;
if (u->sessions)
- pa_hashmap_free(u->sessions, (pa_free_cb_t) free_session);
+ pa_hashmap_free(u->sessions);
if (u->connection) {
pa_dbus_remove_matches(
pa_xfree(device);
}
- pa_hashmap_free(h, NULL);
+ pa_hashmap_free(h);
pa_log_error("Protocol error on reorder");
goto fail;
}
pa_xfree(device);
}
- pa_hashmap_free(h, NULL);
+ pa_hashmap_free(h);
pa_log_error("Client specified an unknown device in it's reorder list.");
goto fail;
}
pa_xfree(device);
}
- pa_hashmap_free(h, NULL);
+ pa_hashmap_free(h);
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);
+ pa_hashmap_free(h);
/* Simple bubble sort */
for (i = 0; i < n_devices; ++i) {
filter_free(f);
}
- pa_hashmap_free(u->filters, NULL);
+ pa_hashmap_free(u->filters);
}
pa_xfree(u);
pa_hook_slot_free(u->sink_input_move_finish_slot);
if (u->cork_state)
- pa_hashmap_free(u->cork_state, NULL);
+ pa_hashmap_free(u->cork_state);
pa_xfree(u);
#ifdef HAVE_DBUS
u->dbus_protocol = pa_dbus_protocol_get(u->core);
- u->dbus_entries = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ u->dbus_entries = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) dbus_entry_free);
pa_assert_se(pa_dbus_protocol_add_interface(u->dbus_protocol, OBJECT_PATH, &stream_restore_interface_info, u) >= 0);
pa_assert_se(pa_dbus_protocol_register_extension(u->dbus_protocol, INTERFACE_STREAM_RESTORE) >= 0);
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, (pa_free_cb_t) dbus_entry_free);
+ pa_hashmap_free(u->dbus_entries);
pa_dbus_protocol_unref(u->dbus_protocol);
}
m->userdata = u = pa_xnew(struct userdata, 1);
u->core = m->core;
u->timeout = timeout * PA_USEC_PER_SEC;
- u->device_infos = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
+ u->device_infos = pa_hashmap_new_full(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func, NULL, (pa_free_cb_t) device_info_free);
PA_IDXSET_FOREACH(sink, m->core->sinks, idx)
device_new_hook_cb(m->core, PA_OBJECT(sink), u);
if (u->source_output_state_changed_slot)
pa_hook_slot_free(u->source_output_state_changed_slot);
- pa_hashmap_free(u->device_infos, (pa_free_cb_t) device_info_free);
+ pa_hashmap_free(u->device_infos);
pa_xfree(u);
}
free(sessions);
}
- pa_hashmap_remove_all(u->previous_sessions, (pa_free_cb_t) free_session);
+ pa_hashmap_remove_all(u->previous_sessions);
return 0;
}
m->userdata = u = pa_xnew0(struct userdata, 1);
u->core = m->core;
u->module = m;
- u->sessions = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
- u->previous_sessions = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ u->sessions = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) free_session);
+ u->previous_sessions = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) free_session);
u->monitor = monitor;
u->io = u->core->mainloop->io_new(u->core->mainloop, sd_login_monitor_get_fd(monitor), PA_IO_EVENT_INPUT, monitor_cb, u);
return;
if (u->sessions) {
- pa_hashmap_free(u->sessions, (pa_free_cb_t) free_session);
- pa_hashmap_free(u->previous_sessions, (pa_free_cb_t) free_session);
+ pa_hashmap_free(u->sessions);
+ pa_hashmap_free(u->previous_sessions);
}
if (u->io)
m->userdata = u = pa_xnew0(struct userdata, 1);
u->core = m->core;
- u->devices = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ u->devices = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) device_free);
u->inotify_fd = -1;
if (pa_modargs_get_value_boolean(ma, "tsched", &use_tsched) < 0) {
pa_close(u->inotify_fd);
if (u->devices)
- pa_hashmap_free(u->devices, (pa_free_cb_t) device_free);
+ pa_hashmap_free(u->devices);
pa_xfree(u);
}
tunnel_free(t);
}
- pa_hashmap_free(u->tunnels, NULL);
+ pa_hashmap_free(u->tunnels);
}
pa_xfree(u);
u->avahi_poll = pa_avahi_poll_new(u->api);
- u->services = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
+ u->services = pa_hashmap_new_full(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func, NULL, (pa_free_cb_t) service_free);
u->sink_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_PUT], PA_HOOK_LATE, (pa_hook_cb_t) device_new_or_changed_cb, u);
u->sink_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_PROPLIST_CHANGED], PA_HOOK_LATE, (pa_hook_cb_t) device_new_or_changed_cb, u);
static void client_free(pa_mainloop_api *api PA_GCC_UNUSED, void *userdata) {
struct userdata *u = (struct userdata *) userdata;
- pa_hashmap_free(u->services, (pa_free_cb_t) service_free);
+ pa_hashmap_free(u->services);
if (u->main_entry_group)
avahi_entry_group_free(u->main_entry_group);
tunnel_free(t);
}
- pa_hashmap_free(u->tunnels, NULL);
+ pa_hashmap_free(u->tunnels);
}
pa_xfree(u);
}
pa_headerlist* pa_headerlist_new(void) {
- return MAKE_HEADERLIST(pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func));
+ return MAKE_HEADERLIST(pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) header_free));
}
void pa_headerlist_free(pa_headerlist* p) {
- pa_hashmap_free(MAKE_HASHMAP(p), (pa_free_cb_t) header_free);
+ pa_hashmap_free(MAKE_HASHMAP(p));
}
int pa_headerlist_puts(pa_headerlist *p, const char *key, const char *value) {
PA_LLIST_HEAD_INIT(struct session, u->sessions);
u->n_sessions = 0;
- u->by_origin = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ u->by_origin = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) session_free);
u->check_death_event = pa_core_rttime_new(m->core, pa_rtclock_now() + DEATH_TIMEOUT * PA_USEC_PER_SEC, check_death_event_cb, u);
pa_sap_context_destroy(&u->sap_context);
if (u->by_origin)
- pa_hashmap_free(u->by_origin, (pa_free_cb_t) session_free);
+ pa_hashmap_free(u->by_origin);
pa_xfree(u->sink_name);
pa_xfree(u);
#endif
if (c->record_streams)
- pa_hashmap_free(c->record_streams, NULL);
+ pa_hashmap_free(c->record_streams);
if (c->playback_streams)
- pa_hashmap_free(c->playback_streams, NULL);
+ pa_hashmap_free(c->playback_streams);
if (c->mempool)
pa_mempool_free(c->mempool);
}
pa_proplist* pa_proplist_new(void) {
- return MAKE_PROPLIST(pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func));
+ return MAKE_PROPLIST(pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) property_free));
}
void pa_proplist_free(pa_proplist* p) {
pa_assert(p);
- pa_hashmap_free(MAKE_HASHMAP(p), (pa_free_cb_t) property_free);
+ pa_hashmap_free(MAKE_HASHMAP(p));
}
/** Will accept only valid UTF-8 */
void pa_proplist_clear(pa_proplist *p) {
pa_assert(p);
- pa_hashmap_remove_all(MAKE_HASHMAP(p), (pa_free_cb_t) property_free);
+ pa_hashmap_remove_all(MAKE_HASHMAP(p));
}
pa_proplist* pa_proplist_copy(const pa_proplist *p) {
memset(data, 0, sizeof(*data));
data->proplist = pa_proplist_new();
- data->profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
- data->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ data->profiles = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) pa_card_profile_free);
+ data->ports = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) pa_device_port_unref);
return data;
}
pa_proplist_free(data->proplist);
if (data->profiles)
- pa_hashmap_free(data->profiles, (pa_free_cb_t) pa_card_profile_free);
+ pa_hashmap_free(data->profiles);
if (data->ports)
- pa_hashmap_free(data->ports, (pa_free_cb_t) pa_device_port_unref);
+ pa_hashmap_free(data->ports);
pa_xfree(data->name);
pa_xfree(data->active_profile);
pa_assert(pa_idxset_isempty(c->sources));
pa_idxset_free(c->sources, NULL);
- pa_hashmap_free(c->ports, (pa_free_cb_t) pa_device_port_unref);
+ pa_hashmap_free(c->ports);
if (c->profiles)
- pa_hashmap_free(c->profiles, (pa_free_cb_t) pa_card_profile_free);
+ pa_hashmap_free(c->profiles);
pa_proplist_free(c->proplist);
pa_xfree(c->driver);
pa_idxset_free(c->sink_inputs, NULL);
pa_assert(pa_hashmap_isempty(c->namereg));
- pa_hashmap_free(c->namereg, NULL);
+ pa_hashmap_free(c->namereg);
pa_assert(pa_hashmap_isempty(c->shared));
- pa_hashmap_free(c->shared, NULL);
+ pa_hashmap_free(c->shared);
pa_subscription_free_all(c);
if (f || errno == ENOENT) { /* file not found is ok */
db = pa_xnew0(simple_data, 1);
- db->map = pa_hashmap_new(hash_func, compare_func);
+ db->map = pa_hashmap_new_full(hash_func, compare_func, NULL, (pa_free_cb_t) free_entry);
db->filename = pa_xstrdup(path);
db->tmp_filename = pa_sprintf_malloc(".%s.tmp", db->filename);
db->read_only = !for_write;
pa_database_sync(database);
pa_xfree(db->filename);
pa_xfree(db->tmp_filename);
- pa_hashmap_free(db->map, (pa_free_cb_t) free_entry);
+ pa_hashmap_free(db->map);
pa_xfree(db);
}
pa_assert(db);
- pa_hashmap_remove_all(db->map, (pa_free_cb_t) free_entry);
+ pa_hashmap_remove_all(db->map);
return 0;
}
pa_proplist_free(p->proplist);
if (p->profiles)
- pa_hashmap_free(p->profiles, NULL);
+ pa_hashmap_free(p->profiles);
pa_xfree(p->name);
pa_xfree(p->description);
#define NBUCKETS 127
struct hashmap_entry {
- const void *key;
+ void *key;
void *value;
struct hashmap_entry *bucket_next, *bucket_previous;
pa_hash_func_t hash_func;
pa_compare_func_t compare_func;
+ pa_free_cb_t key_free_func;
+ pa_free_cb_t value_free_func;
+
struct hashmap_entry *iterate_list_head, *iterate_list_tail;
unsigned n_entries;
};
PA_STATIC_FLIST_DECLARE(entries, 0, pa_xfree);
-pa_hashmap *pa_hashmap_new(pa_hash_func_t hash_func, pa_compare_func_t compare_func) {
+pa_hashmap *pa_hashmap_new_full(pa_hash_func_t hash_func, pa_compare_func_t compare_func, pa_free_cb_t key_free_func, pa_free_cb_t value_free_func) {
pa_hashmap *h;
h = pa_xmalloc0(PA_ALIGN(sizeof(pa_hashmap)) + NBUCKETS*sizeof(struct hashmap_entry*));
h->hash_func = hash_func ? hash_func : pa_idxset_trivial_hash_func;
h->compare_func = compare_func ? compare_func : pa_idxset_trivial_compare_func;
+ h->key_free_func = key_free_func;
+ h->value_free_func = value_free_func;
+
h->n_entries = 0;
h->iterate_list_head = h->iterate_list_tail = NULL;
return h;
}
+pa_hashmap *pa_hashmap_new(pa_hash_func_t hash_func, pa_compare_func_t compare_func) {
+ return pa_hashmap_new_full(hash_func, compare_func, NULL, NULL);
+}
+
static void remove_entry(pa_hashmap *h, struct hashmap_entry *e) {
pa_assert(h);
pa_assert(e);
BY_HASH(h)[hash] = e->bucket_next;
}
+ if (h->key_free_func)
+ h->key_free_func(e->key);
+
if (pa_flist_push(PA_STATIC_FLIST_GET(entries), e) < 0)
pa_xfree(e);
h->n_entries--;
}
-void pa_hashmap_free(pa_hashmap *h, pa_free_cb_t free_cb) {
+void pa_hashmap_free(pa_hashmap *h) {
pa_assert(h);
- pa_hashmap_remove_all(h, free_cb);
+ pa_hashmap_remove_all(h);
pa_xfree(h);
}
return NULL;
}
-int pa_hashmap_put(pa_hashmap *h, const void *key, void *value) {
+int pa_hashmap_put(pa_hashmap *h, void *key, void *value) {
struct hashmap_entry *e;
unsigned hash;
return data;
}
-void pa_hashmap_remove_all(pa_hashmap *h, pa_free_cb_t free_cb) {
+void pa_hashmap_remove_all(pa_hashmap *h) {
pa_assert(h);
while (h->iterate_list_head) {
data = h->iterate_list_head->value;
remove_entry(h, h->iterate_list_head);
- if (free_cb)
- free_cb(data);
+ if (h->value_free_func)
+ h->value_free_func(data);
}
}
/* Create a new hashmap. Use the specified functions for hashing and comparing objects in the map */
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_free_cb_t free_cb);
+/* Create a new hashmap. Use the specified functions for hashing and comparing objects in the map, and functions to free the key
+ * and value (either or both can be NULL). */
+pa_hashmap *pa_hashmap_new_full(pa_hash_func_t hash_func, pa_compare_func_t compare_func, pa_free_cb_t key_free_func, pa_free_cb_t value_free_func);
+
+/* Free the hash table. */
+void pa_hashmap_free(pa_hashmap*);
/* 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);
+int pa_hashmap_put(pa_hashmap *h, void *key, void *value);
/* Return an entry from the hashmap */
void* pa_hashmap_get(pa_hashmap *h, const void *key);
/* Returns the data of the entry while removing */
void* pa_hashmap_remove(pa_hashmap *h, const void *key);
-/* If free_cb is not NULL, it's called for each entry. */
-void pa_hashmap_remove_all(pa_hashmap *h, pa_free_cb_t free_cb);
+/* Remove all entries but don't free the hashmap */
+void pa_hashmap_remove_all(pa_hashmap *h);
/* Return the current number of entries of the hashmap */
unsigned pa_hashmap_size(pa_hashmap *h);
pa_mutex_unlock(i->pool->mutex);
- pa_hashmap_free(i->blocks, NULL);
- pa_hashmap_free(i->segments, NULL);
+ pa_hashmap_free(i->blocks);
+ pa_hashmap_free(i->segments);
pa_mutex_free(i->mutex);
return 0;
}
+static void free_func(void *p) {
+ struct entry *e = p;
+ pa_assert(e);
+
+ pa_xfree(e->key);
+ pa_xfree(e->value);
+ pa_xfree(e);
+}
+
pa_modargs *pa_modargs_new(const char *args, const char* const* valid_keys) {
enum {
WHITESPACE,
size_t key_len = 0, value_len = 0;
pa_modargs *ma = pa_xnew(pa_modargs, 1);
- ma->raw = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
- ma->unescaped = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ ma->raw = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, free_func);
+ ma->unescaped = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, free_func);
if (!args)
return ma;
return NULL;
}
-static void free_func(void *p) {
- struct entry *e = p;
- pa_assert(e);
-
- pa_xfree(e->key);
- pa_xfree(e->value);
- pa_xfree(e);
-}
-
void pa_modargs_free(pa_modargs*ma) {
pa_assert(ma);
- pa_hashmap_free(ma->raw, free_func);
- pa_hashmap_free(ma->unescaped, free_func);
+ pa_hashmap_free(ma->raw);
+ pa_hashmap_free(ma->unescaped);
pa_xfree(ma);
}
void pa_cond_free(pa_cond *c) {
assert(c);
- pa_hashmap_free(c->wait_events, NULL);
+ pa_hashmap_free(c->wait_events);
pa_xfree(c);
}
pa_assert(pa_hashmap_isempty(p->connections));
pa_assert(pa_idxset_isempty(p->extensions));
- pa_hashmap_free(p->objects, NULL);
- pa_hashmap_free(p->connections, NULL);
+ pa_hashmap_free(p->objects);
+ pa_hashmap_free(p->connections);
pa_idxset_free(p->extensions, NULL);
for (i = 0; i < PA_DBUS_PROTOCOL_HOOK_MAX; ++i)
return dst;
}
+static void method_handler_free(pa_dbus_method_handler *h) {
+ unsigned i;
+
+ pa_assert(h);
+
+ pa_xfree((char *) h->method_name);
+
+ for (i = 0; i < h->n_arguments; ++i) {
+ pa_xfree((char *) h->arguments[i].name);
+ pa_xfree((char *) h->arguments[i].type);
+ pa_xfree((char *) h->arguments[i].direction);
+ }
+
+ pa_xfree((pa_dbus_arg_info *) h->arguments);
+ pa_xfree(h);
+}
+
static pa_hashmap *create_method_handlers(const pa_dbus_interface_info *info) {
pa_hashmap *handlers;
unsigned i;
pa_assert(info);
pa_assert(info->method_handlers || info->n_method_handlers == 0);
- handlers = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ handlers = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) method_handler_free);
for (i = 0; i < info->n_method_handlers; ++i) {
pa_dbus_method_handler *h = pa_xnew(pa_dbus_method_handler, 1);
h->n_arguments = info->method_handlers[i].n_arguments;
h->receive_cb = info->method_handlers[i].receive_cb;
- pa_hashmap_put(handlers, h->method_name, h);
+ pa_hashmap_put(handlers, (char *) h->method_name, h);
}
return handlers;
pa_assert(method_handlers);
- signatures = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ signatures = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, pa_xfree);
PA_HASHMAP_FOREACH(handler, method_handlers, state) {
sig_buf = pa_strbuf_new();
pa_strbuf_puts(sig_buf, handler->arguments[i].type);
}
- pa_hashmap_put(signatures, handler->method_name, pa_strbuf_tostring_free(sig_buf));
+ pa_hashmap_put(signatures, (char *) handler->method_name, pa_strbuf_tostring_free(sig_buf));
}
return signatures;
}
+static void property_handler_free(pa_dbus_property_handler *h) {
+ pa_assert(h);
+
+ pa_xfree((char *) h->property_name);
+ pa_xfree((char *) h->type);
+
+ pa_xfree(h);
+}
+
static pa_hashmap *create_property_handlers(const pa_dbus_interface_info *info) {
pa_hashmap *handlers;
unsigned i = 0;
pa_assert(info);
pa_assert(info->property_handlers || info->n_property_handlers == 0);
- handlers = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ handlers = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) property_handler_free);
for (i = 0; i < info->n_property_handlers; ++i) {
pa_dbus_property_handler *h = pa_xnew(pa_dbus_property_handler, 1);
h->get_cb = info->property_handlers[i].get_cb;
h->set_cb = info->property_handlers[i].set_cb;
- pa_hashmap_put(handlers, h->property_name, h);
+ pa_hashmap_put(handlers, (char *) h->property_name, h);
}
return handlers;
pa_assert_se(dbus_connection_unregister_object_path(conn_entry->connection, obj_entry->path));
}
-static void method_handler_free(pa_dbus_method_handler *h) {
- unsigned i;
-
- pa_assert(h);
-
- pa_xfree((char *) h->method_name);
-
- for (i = 0; i < h->n_arguments; ++i) {
- pa_xfree((char *) h->arguments[i].name);
- pa_xfree((char *) h->arguments[i].type);
- pa_xfree((char *) h->arguments[i].direction);
- }
-
- pa_xfree((pa_dbus_arg_info *) h->arguments);
- pa_xfree(h);
-}
-
-static void property_handler_free(pa_dbus_property_handler *h) {
- pa_assert(h);
-
- pa_xfree((char *) h->property_name);
- pa_xfree((char *) h->type);
-
- pa_xfree(h);
-}
-
int pa_dbus_protocol_remove_interface(pa_dbus_protocol *p, const char* path, const char* interface) {
struct object_entry *obj_entry;
struct interface_entry *iface_entry;
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, 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);
+ pa_hashmap_free(iface_entry->method_signatures);
+ pa_hashmap_free(iface_entry->method_handlers);
+ pa_hashmap_free(iface_entry->property_handlers);
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);
+ pa_hashmap_free(obj_entry->interfaces);
pa_xfree(obj_entry->introspection);
pa_xfree(obj_entry);
}
pa_assert_se(dbus_connection_register_object_path(conn, obj_entry->path, &vtable, p));
}
+static void signal_paths_entry_free(struct signal_paths_entry *e) {
+ pa_assert(e);
+
+ pa_xfree(e->signal);
+ pa_idxset_free(e->paths, pa_xfree);
+ pa_xfree(e);
+}
+
int pa_dbus_protocol_register_connection(pa_dbus_protocol *p, DBusConnection *conn, pa_client *client) {
struct connection_entry *conn_entry;
conn_entry->client = client;
conn_entry->listening_for_all_signals = false;
conn_entry->all_signals_objects = pa_idxset_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
- conn_entry->listening_signals = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ conn_entry->listening_signals = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL,
+ (pa_free_cb_t) signal_paths_entry_free);
pa_hashmap_put(p->connections, conn, conn_entry);
return e;
}
-static void signal_paths_entry_free(struct signal_paths_entry *e) {
- pa_assert(e);
-
- pa_xfree(e->signal);
- pa_idxset_free(e->paths, pa_xfree);
- pa_xfree(e);
-}
-
int pa_dbus_protocol_unregister_connection(pa_dbus_protocol *p, DBusConnection *conn) {
struct connection_entry *conn_entry = NULL;
dbus_connection_unref(conn_entry->connection);
pa_idxset_free(conn_entry->all_signals_objects, pa_xfree);
- pa_hashmap_free(conn_entry->listening_signals, (pa_free_cb_t) signal_paths_entry_free);
+ pa_hashmap_free(conn_entry->listening_signals);
pa_xfree(conn_entry);
return 0;
/* We're not interested in individual signals anymore, so let's empty
* listening_signals. */
- pa_hashmap_remove_all(conn_entry->listening_signals, (pa_free_cb_t) signal_paths_entry_free);
+ pa_hashmap_remove_all(conn_entry->listening_signals);
for (i = 0; i < n_objects; ++i)
pa_idxset_put(conn_entry->all_signals_objects, pa_xstrdup(objects[i]), NULL);
} else {
conn_entry->listening_for_all_signals = false;
pa_idxset_remove_all(conn_entry->all_signals_objects, pa_xfree);
- pa_hashmap_remove_all(conn_entry->listening_signals, (pa_free_cb_t) signal_paths_entry_free);
+ pa_hashmap_remove_all(conn_entry->listening_signals);
}
}
for (h = 0; h < PA_NATIVE_HOOK_MAX; h++)
pa_hook_done(&p->hooks[h]);
- pa_hashmap_free(p->extensions, NULL);
+ pa_hashmap_free(p->extensions);
pa_assert_se(pa_shared_remove(p->core, "native-protocol") >= 0);
data->proplist = pa_proplist_new();
data->volume_writable = true;
- data->volume_factor_items = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
- data->volume_factor_sink_items = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ data->volume_factor_items = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL,
+ (pa_free_cb_t) volume_factor_entry_free);
+ data->volume_factor_sink_items = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL,
+ (pa_free_cb_t) volume_factor_entry_free);
return data;
}
pa_format_info_free(data->format);
if (data->volume_factor_items)
- pa_hashmap_free(data->volume_factor_items, (pa_free_cb_t) volume_factor_entry_free);
+ pa_hashmap_free(data->volume_factor_items);
if (data->volume_factor_sink_items)
- pa_hashmap_free(data->volume_factor_sink_items, (pa_free_cb_t) volume_factor_entry_free);
+ pa_hashmap_free(data->volume_factor_sink_items);
pa_proplist_free(data->proplist);
}
pa_idxset_free(i->direct_outputs, NULL);
if (i->thread_info.direct_outputs)
- pa_hashmap_free(i->thread_info.direct_outputs, NULL);
+ pa_hashmap_free(i->thread_info.direct_outputs);
if (i->volume_factor_items)
- pa_hashmap_free(i->volume_factor_items, (pa_free_cb_t) volume_factor_entry_free);
+ pa_hashmap_free(i->volume_factor_items);
if (i->volume_factor_sink_items)
- pa_hashmap_free(i->volume_factor_sink_items, (pa_free_cb_t) volume_factor_entry_free);
+ pa_hashmap_free(i->volume_factor_sink_items);
pa_xfree(i->driver);
pa_xfree(i);
pa_zero(*data);
data->proplist = pa_proplist_new();
- data->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ data->ports = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) pa_device_port_unref);
return data;
}
pa_proplist_free(data->proplist);
if (data->ports)
- pa_hashmap_free(data->ports, (pa_free_cb_t) pa_device_port_unref);
+ pa_hashmap_free(data->ports);
pa_xfree(data->name);
pa_xfree(data->active_port);
0);
s->thread_info.rtpoll = NULL;
- s->thread_info.inputs = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
+ s->thread_info.inputs = pa_hashmap_new_full(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func, NULL,
+ (pa_free_cb_t) pa_sink_input_unref);
s->thread_info.soft_volume = s->soft_volume;
s->thread_info.soft_muted = s->muted;
s->thread_info.state = s->state;
}
pa_idxset_free(s->inputs, NULL);
- pa_hashmap_free(s->thread_info.inputs, (pa_free_cb_t) pa_sink_input_unref);
+ pa_hashmap_free(s->thread_info.inputs);
if (s->silence.memblock)
pa_memblock_unref(s->silence.memblock);
pa_proplist_free(s->proplist);
if (s->ports)
- pa_hashmap_free(s->ports, (pa_free_cb_t) pa_device_port_unref);
+ pa_hashmap_free(s->ports);
pa_xfree(s);
}
pa_zero(*data);
data->proplist = pa_proplist_new();
- data->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ data->ports = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) pa_device_port_unref);
return data;
}
pa_proplist_free(data->proplist);
if (data->ports)
- pa_hashmap_free(data->ports, (pa_free_cb_t) pa_device_port_unref);
+ pa_hashmap_free(data->ports);
pa_xfree(data->name);
pa_xfree(data->active_port);
0);
s->thread_info.rtpoll = NULL;
- s->thread_info.outputs = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
+ s->thread_info.outputs = pa_hashmap_new_full(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func, NULL,
+ (pa_free_cb_t) pa_source_output_unref);
s->thread_info.soft_volume = s->soft_volume;
s->thread_info.soft_muted = s->muted;
s->thread_info.state = s->state;
pa_log_info("Freeing source %u \"%s\"", s->index, s->name);
pa_idxset_free(s->outputs, NULL);
- pa_hashmap_free(s->thread_info.outputs, (pa_free_cb_t) pa_source_output_unref);
+ pa_hashmap_free(s->thread_info.outputs);
if (s->silence.memblock)
pa_memblock_unref(s->silence.memblock);
pa_proplist_free(s->proplist);
if (s->ports)
- pa_hashmap_free(s->ports, (pa_free_cb_t) pa_device_port_unref);
+ pa_hashmap_free(s->ports);
pa_xfree(s);
}