mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-12 13:30:10 -05:00
Use pa_hashmap_remove_and_free() where appropriate
This commit is contained in:
parent
14e2553185
commit
eca082a93f
14 changed files with 29 additions and 84 deletions
|
|
@ -322,18 +322,11 @@ int pa_database_set(pa_database *database, const pa_datum *key, const pa_datum*
|
|||
|
||||
int pa_database_unset(pa_database *database, const pa_datum *key) {
|
||||
simple_data *db = (simple_data*)database;
|
||||
entry *e;
|
||||
|
||||
pa_assert(db);
|
||||
pa_assert(key);
|
||||
|
||||
e = pa_hashmap_remove(db->map, key);
|
||||
if (!e)
|
||||
return -1;
|
||||
|
||||
free_entry(e);
|
||||
|
||||
return 0;
|
||||
return pa_hashmap_remove_and_free(db->map, key);
|
||||
}
|
||||
|
||||
int pa_database_clear(pa_database *database) {
|
||||
|
|
|
|||
|
|
@ -993,8 +993,7 @@ void pa_dbus_protocol_add_signal_listener(
|
|||
|
||||
/* Replace the old signal paths entry for this signal with a new
|
||||
* one. */
|
||||
if ((signal_paths_entry = pa_hashmap_remove(conn_entry->listening_signals, signal_name)))
|
||||
signal_paths_entry_free(signal_paths_entry);
|
||||
pa_hashmap_remove_and_free(conn_entry->listening_signals, signal_name);
|
||||
signal_paths_entry = signal_paths_entry_new(signal_name);
|
||||
|
||||
for (i = 0; i < n_objects; ++i)
|
||||
|
|
|
|||
|
|
@ -1324,13 +1324,9 @@ int pa_sink_input_remove_volume_factor(pa_sink_input *i, const char *key) {
|
|||
pa_assert_ctl_context();
|
||||
pa_assert(PA_SINK_INPUT_IS_LINKED(i->state));
|
||||
|
||||
v = pa_hashmap_remove(i->volume_factor_items, key);
|
||||
|
||||
if (!v)
|
||||
if (pa_hashmap_remove_and_free(i->volume_factor_items, key) < 0)
|
||||
return -1;
|
||||
|
||||
volume_factor_entry_free(v);
|
||||
|
||||
switch (pa_hashmap_size(i->volume_factor_items)) {
|
||||
case 0:
|
||||
pa_cvolume_reset(&i->volume_factor, i->sample_spec.channels);
|
||||
|
|
|
|||
|
|
@ -2547,9 +2547,7 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
|
|||
i->thread_info.sync_next = NULL;
|
||||
}
|
||||
|
||||
if (pa_hashmap_remove(s->thread_info.inputs, PA_UINT32_TO_PTR(i->index)))
|
||||
pa_sink_input_unref(i);
|
||||
|
||||
pa_hashmap_remove_and_free(s->thread_info.inputs, PA_UINT32_TO_PTR(i->index));
|
||||
pa_sink_invalidate_requested_latency(s, true);
|
||||
pa_sink_request_rewind(s, (size_t) -1);
|
||||
|
||||
|
|
@ -2630,8 +2628,7 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
|
|||
i->thread_info.attached = false;
|
||||
|
||||
/* Let's remove the sink input ...*/
|
||||
if (pa_hashmap_remove(s->thread_info.inputs, PA_UINT32_TO_PTR(i->index)))
|
||||
pa_sink_input_unref(i);
|
||||
pa_hashmap_remove_and_free(s->thread_info.inputs, PA_UINT32_TO_PTR(i->index));
|
||||
|
||||
pa_sink_invalidate_requested_latency(s, true);
|
||||
|
||||
|
|
|
|||
|
|
@ -2070,9 +2070,7 @@ int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, int64_
|
|||
o->thread_info.direct_on_input = NULL;
|
||||
}
|
||||
|
||||
if (pa_hashmap_remove(s->thread_info.outputs, PA_UINT32_TO_PTR(o->index)))
|
||||
pa_source_output_unref(o);
|
||||
|
||||
pa_hashmap_remove_and_free(s->thread_info.outputs, PA_UINT32_TO_PTR(o->index));
|
||||
pa_source_invalidate_requested_latency(s, true);
|
||||
|
||||
/* In flat volume mode we need to update the volume as
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue