mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-09 13:29:59 -05:00
idxset: Use pa_free_cb_t instead of pa_free2_cb_t
There were no users for the userdata pointer.
This commit is contained in:
parent
43e7868008
commit
061878b5a4
27 changed files with 81 additions and 119 deletions
|
|
@ -233,9 +233,9 @@ void pa_card_free(pa_card *c) {
|
|||
pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_REMOVE, c->index);
|
||||
|
||||
pa_assert(pa_idxset_isempty(c->sinks));
|
||||
pa_idxset_free(c->sinks, NULL, NULL);
|
||||
pa_idxset_free(c->sinks, NULL);
|
||||
pa_assert(pa_idxset_isempty(c->sources));
|
||||
pa_idxset_free(c->sources, NULL, NULL);
|
||||
pa_idxset_free(c->sources, NULL);
|
||||
|
||||
pa_hashmap_free(c->ports, (pa_free_cb_t) pa_device_port_unref);
|
||||
|
||||
|
|
|
|||
|
|
@ -103,9 +103,9 @@ void pa_client_free(pa_client *c) {
|
|||
pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CLIENT|PA_SUBSCRIPTION_EVENT_REMOVE, c->index);
|
||||
|
||||
pa_assert(pa_idxset_isempty(c->sink_inputs));
|
||||
pa_idxset_free(c->sink_inputs, NULL, NULL);
|
||||
pa_idxset_free(c->sink_inputs, NULL);
|
||||
pa_assert(pa_idxset_isempty(c->source_outputs));
|
||||
pa_idxset_free(c->source_outputs, NULL, NULL);
|
||||
pa_idxset_free(c->source_outputs, NULL);
|
||||
|
||||
pa_proplist_free(c->proplist);
|
||||
pa_xfree(c->driver);
|
||||
|
|
|
|||
|
|
@ -170,28 +170,28 @@ static void core_free(pa_object *o) {
|
|||
* we get here */
|
||||
|
||||
pa_assert(pa_idxset_isempty(c->scache));
|
||||
pa_idxset_free(c->scache, NULL, NULL);
|
||||
pa_idxset_free(c->scache, NULL);
|
||||
|
||||
pa_assert(pa_idxset_isempty(c->modules));
|
||||
pa_idxset_free(c->modules, NULL, NULL);
|
||||
pa_idxset_free(c->modules, NULL);
|
||||
|
||||
pa_assert(pa_idxset_isempty(c->clients));
|
||||
pa_idxset_free(c->clients, NULL, NULL);
|
||||
pa_idxset_free(c->clients, NULL);
|
||||
|
||||
pa_assert(pa_idxset_isempty(c->cards));
|
||||
pa_idxset_free(c->cards, NULL, NULL);
|
||||
pa_idxset_free(c->cards, NULL);
|
||||
|
||||
pa_assert(pa_idxset_isempty(c->sinks));
|
||||
pa_idxset_free(c->sinks, NULL, NULL);
|
||||
pa_idxset_free(c->sinks, NULL);
|
||||
|
||||
pa_assert(pa_idxset_isempty(c->sources));
|
||||
pa_idxset_free(c->sources, NULL, NULL);
|
||||
pa_idxset_free(c->sources, NULL);
|
||||
|
||||
pa_assert(pa_idxset_isempty(c->source_outputs));
|
||||
pa_idxset_free(c->source_outputs, NULL, NULL);
|
||||
pa_idxset_free(c->source_outputs, NULL);
|
||||
|
||||
pa_assert(pa_idxset_isempty(c->sink_inputs));
|
||||
pa_idxset_free(c->sink_inputs, NULL, NULL);
|
||||
pa_idxset_free(c->sink_inputs, NULL);
|
||||
|
||||
pa_assert(pa_hashmap_isempty(c->namereg));
|
||||
pa_hashmap_free(c->namereg, NULL);
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ static void remove_entry(pa_idxset *s, struct idxset_entry *e) {
|
|||
s->n_entries--;
|
||||
}
|
||||
|
||||
void pa_idxset_free(pa_idxset *s, pa_free2_cb_t free_cb, void *userdata) {
|
||||
void pa_idxset_free(pa_idxset *s, pa_free_cb_t free_cb) {
|
||||
pa_assert(s);
|
||||
|
||||
while (s->iterate_list_head) {
|
||||
|
|
@ -148,7 +148,7 @@ void pa_idxset_free(pa_idxset *s, pa_free2_cb_t free_cb, void *userdata) {
|
|||
remove_entry(s, s->iterate_list_head);
|
||||
|
||||
if (free_cb)
|
||||
free_cb(data, userdata);
|
||||
free_cb(data);
|
||||
}
|
||||
|
||||
pa_xfree(s);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <pulse/def.h>
|
||||
|
||||
#include <pulsecore/macro.h>
|
||||
|
||||
/* A combination of a set and a dynamic array. Entries are indexable
|
||||
|
|
@ -35,9 +37,6 @@
|
|||
/* A special index value denoting the invalid index. */
|
||||
#define PA_IDXSET_INVALID ((uint32_t) -1)
|
||||
|
||||
/* Similar to pa_free_cb_t, but takes a userdata argument */
|
||||
typedef void (*pa_free2_cb_t)(void *p, void *userdata);
|
||||
|
||||
/* Generic implementations for hash and comparison functions. Just
|
||||
* compares the pointer or calculates the hash value directly from the
|
||||
* pointer value. */
|
||||
|
|
@ -57,7 +56,7 @@ typedef struct pa_idxset pa_idxset;
|
|||
pa_idxset* pa_idxset_new(pa_hash_func_t hash_func, pa_compare_func_t compare_func);
|
||||
|
||||
/* Free the idxset. When the idxset is not empty the specified function is called for every entry contained */
|
||||
void pa_idxset_free(pa_idxset *s, pa_free2_cb_t free_cb, void *userdata);
|
||||
void pa_idxset_free(pa_idxset *s, pa_free_cb_t free_cb);
|
||||
|
||||
/* Store a new item in the idxset. The index of the item is returned in *idx */
|
||||
int pa_idxset_put(pa_idxset*s, void *p, uint32_t *idx);
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ void pa_cli_protocol_unref(pa_cli_protocol *p) {
|
|||
while ((c = pa_idxset_first(p->connections, NULL)))
|
||||
cli_unlink(p, c);
|
||||
|
||||
pa_idxset_free(p->connections, NULL, NULL);
|
||||
pa_idxset_free(p->connections, NULL);
|
||||
|
||||
pa_assert_se(pa_shared_remove(p->core, "cli-protocol") >= 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ void pa_dbus_protocol_unref(pa_dbus_protocol *p) {
|
|||
|
||||
pa_hashmap_free(p->objects, NULL);
|
||||
pa_hashmap_free(p->connections, NULL);
|
||||
pa_idxset_free(p->extensions, NULL, NULL);
|
||||
pa_idxset_free(p->extensions, NULL);
|
||||
|
||||
for (i = 0; i < PA_DBUS_PROTOCOL_HOOK_MAX; ++i)
|
||||
pa_hook_done(&p->hooks[i]);
|
||||
|
|
@ -928,22 +928,15 @@ static struct signal_paths_entry *signal_paths_entry_new(const char *signal_name
|
|||
}
|
||||
|
||||
static void signal_paths_entry_free(struct signal_paths_entry *e) {
|
||||
char *path = NULL;
|
||||
|
||||
pa_assert(e);
|
||||
|
||||
pa_xfree(e->signal);
|
||||
|
||||
while ((path = pa_idxset_steal_first(e->paths, NULL)))
|
||||
pa_xfree(path);
|
||||
|
||||
pa_idxset_free(e->paths, NULL, NULL);
|
||||
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;
|
||||
char *object_path = NULL;
|
||||
|
||||
pa_assert(p);
|
||||
pa_assert(conn);
|
||||
|
|
@ -954,12 +947,7 @@ int pa_dbus_protocol_unregister_connection(pa_dbus_protocol *p, DBusConnection *
|
|||
unregister_all_objects(p, conn);
|
||||
|
||||
dbus_connection_unref(conn_entry->connection);
|
||||
|
||||
while ((object_path = pa_idxset_steal_first(conn_entry->all_signals_objects, NULL)))
|
||||
pa_xfree(object_path);
|
||||
|
||||
pa_idxset_free(conn_entry->all_signals_objects, NULL, NULL);
|
||||
|
||||
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_xfree(conn_entry);
|
||||
|
||||
|
|
|
|||
|
|
@ -1627,7 +1627,7 @@ void pa_esound_protocol_unref(pa_esound_protocol *p) {
|
|||
while ((c = pa_idxset_first(p->connections, NULL)))
|
||||
connection_unlink(c);
|
||||
|
||||
pa_idxset_free(p->connections, NULL, NULL);
|
||||
pa_idxset_free(p->connections, NULL);
|
||||
|
||||
pa_assert_se(pa_shared_remove(p->core, "esound-protocol") >= 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -786,7 +786,7 @@ void pa_http_protocol_unref(pa_http_protocol *p) {
|
|||
while ((c = pa_idxset_first(p->connections, NULL)))
|
||||
connection_unlink(c);
|
||||
|
||||
pa_idxset_free(p->connections, NULL, NULL);
|
||||
pa_idxset_free(p->connections, NULL);
|
||||
|
||||
pa_strlist_free(p->servers);
|
||||
|
||||
|
|
|
|||
|
|
@ -1222,7 +1222,7 @@ static playback_stream* playback_stream_new(
|
|||
|
||||
out:
|
||||
if (formats)
|
||||
pa_idxset_free(formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
@ -1340,8 +1340,8 @@ static void native_connection_free(pa_object *o) {
|
|||
|
||||
native_connection_unlink(c);
|
||||
|
||||
pa_idxset_free(c->record_streams, NULL, NULL);
|
||||
pa_idxset_free(c->output_streams, NULL, NULL);
|
||||
pa_idxset_free(c->record_streams, NULL);
|
||||
pa_idxset_free(c->output_streams, NULL);
|
||||
|
||||
pa_pdispatch_unref(c->pdispatch);
|
||||
pa_pstream_unref(c->pstream);
|
||||
|
|
@ -2193,7 +2193,7 @@ finish:
|
|||
if (p)
|
||||
pa_proplist_free(p);
|
||||
if (formats)
|
||||
pa_idxset_free(formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free);
|
||||
}
|
||||
|
||||
static void command_delete_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
|
||||
|
|
@ -2508,7 +2508,7 @@ finish:
|
|||
if (p)
|
||||
pa_proplist_free(p);
|
||||
if (formats)
|
||||
pa_idxset_free(formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free);
|
||||
}
|
||||
|
||||
static void command_exit(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
|
||||
|
|
@ -3143,7 +3143,7 @@ static void sink_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_sin
|
|||
pa_tagstruct_put_format_info(t, f);
|
||||
}
|
||||
|
||||
pa_idxset_free(formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3213,7 +3213,7 @@ static void source_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_s
|
|||
pa_tagstruct_put_format_info(t, f);
|
||||
}
|
||||
|
||||
pa_idxset_free(formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5093,7 +5093,7 @@ void pa_native_protocol_unref(pa_native_protocol *p) {
|
|||
while ((c = pa_idxset_first(p->connections, NULL)))
|
||||
native_connection_unlink(c);
|
||||
|
||||
pa_idxset_free(p->connections, NULL, NULL);
|
||||
pa_idxset_free(p->connections, NULL);
|
||||
|
||||
pa_strlist_free(p->servers);
|
||||
|
||||
|
|
|
|||
|
|
@ -690,7 +690,7 @@ void pa_simple_protocol_unref(pa_simple_protocol *p) {
|
|||
while ((c = pa_idxset_first(p->connections, NULL)))
|
||||
connection_unlink(c);
|
||||
|
||||
pa_idxset_free(p->connections, NULL, NULL);
|
||||
pa_idxset_free(p->connections, NULL);
|
||||
|
||||
pa_assert_se(pa_shared_remove(p->core, "simple-protocol") >= 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -198,12 +198,12 @@ pa_bool_t pa_sink_input_new_data_set_sink(pa_sink_input_new_data *data, pa_sink
|
|||
data->sink = s;
|
||||
data->save_sink = save;
|
||||
if (data->nego_formats)
|
||||
pa_idxset_free(data->nego_formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(data->nego_formats, (pa_free_cb_t) pa_format_info_free);
|
||||
data->nego_formats = formats;
|
||||
} else {
|
||||
/* Sink doesn't support any of the formats requested by the client */
|
||||
if (formats)
|
||||
pa_idxset_free(formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free);
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
|
|
@ -216,7 +216,7 @@ pa_bool_t pa_sink_input_new_data_set_formats(pa_sink_input_new_data *data, pa_id
|
|||
pa_assert(formats);
|
||||
|
||||
if (data->req_formats)
|
||||
pa_idxset_free(formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free);
|
||||
|
||||
data->req_formats = formats;
|
||||
|
||||
|
|
@ -232,10 +232,10 @@ void pa_sink_input_new_data_done(pa_sink_input_new_data *data) {
|
|||
pa_assert(data);
|
||||
|
||||
if (data->req_formats)
|
||||
pa_idxset_free(data->req_formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(data->req_formats, (pa_free_cb_t) pa_format_info_free);
|
||||
|
||||
if (data->nego_formats)
|
||||
pa_idxset_free(data->nego_formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(data->nego_formats, (pa_free_cb_t) pa_format_info_free);
|
||||
|
||||
if (data->format)
|
||||
pa_format_info_free(data->format);
|
||||
|
|
@ -738,7 +738,7 @@ static void sink_input_free(pa_object *o) {
|
|||
pa_proplist_free(i->proplist);
|
||||
|
||||
if (i->direct_outputs)
|
||||
pa_idxset_free(i->direct_outputs, NULL, NULL);
|
||||
pa_idxset_free(i->direct_outputs, NULL);
|
||||
|
||||
if (i->thread_info.direct_outputs)
|
||||
pa_hashmap_free(i->thread_info.direct_outputs, NULL);
|
||||
|
|
|
|||
|
|
@ -730,7 +730,7 @@ static void sink_free(pa_object *o) {
|
|||
s->monitor_source = NULL;
|
||||
}
|
||||
|
||||
pa_idxset_free(s->inputs, NULL, NULL);
|
||||
pa_idxset_free(s->inputs, NULL);
|
||||
pa_hashmap_free(s->thread_info.inputs, (pa_free_cb_t) pa_sink_input_unref);
|
||||
|
||||
if (s->silence.memblock)
|
||||
|
|
@ -3734,7 +3734,7 @@ pa_bool_t pa_sink_check_format(pa_sink *s, pa_format_info *f)
|
|||
}
|
||||
}
|
||||
|
||||
pa_idxset_free(formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -3764,7 +3764,7 @@ pa_idxset* pa_sink_check_formats(pa_sink *s, pa_idxset *in_formats) {
|
|||
|
||||
done:
|
||||
if (sink_formats)
|
||||
pa_idxset_free(sink_formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(sink_formats, (pa_free_cb_t) pa_format_info_free);
|
||||
|
||||
return out_formats;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,12 +143,12 @@ pa_bool_t pa_source_output_new_data_set_source(pa_source_output_new_data *data,
|
|||
data->source = s;
|
||||
data->save_source = save;
|
||||
if (data->nego_formats)
|
||||
pa_idxset_free(data->nego_formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(data->nego_formats, (pa_free_cb_t) pa_format_info_free);
|
||||
data->nego_formats = formats;
|
||||
} else {
|
||||
/* Source doesn't support any of the formats requested by the client */
|
||||
if (formats)
|
||||
pa_idxset_free(formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free);
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ pa_bool_t pa_source_output_new_data_set_formats(pa_source_output_new_data *data,
|
|||
pa_assert(formats);
|
||||
|
||||
if (data->req_formats)
|
||||
pa_idxset_free(formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free);
|
||||
|
||||
data->req_formats = formats;
|
||||
|
||||
|
|
@ -177,10 +177,10 @@ void pa_source_output_new_data_done(pa_source_output_new_data *data) {
|
|||
pa_assert(data);
|
||||
|
||||
if (data->req_formats)
|
||||
pa_idxset_free(data->req_formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(data->req_formats, (pa_free_cb_t) pa_format_info_free);
|
||||
|
||||
if (data->nego_formats)
|
||||
pa_idxset_free(data->nego_formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(data->nego_formats, (pa_free_cb_t) pa_format_info_free);
|
||||
|
||||
if (data->format)
|
||||
pa_format_info_free(data->format);
|
||||
|
|
|
|||
|
|
@ -659,7 +659,7 @@ static void source_free(pa_object *o) {
|
|||
|
||||
pa_log_info("Freeing source %u \"%s\"", s->index, s->name);
|
||||
|
||||
pa_idxset_free(s->outputs, NULL, NULL);
|
||||
pa_idxset_free(s->outputs, NULL);
|
||||
pa_hashmap_free(s->thread_info.outputs, (pa_free_cb_t) pa_source_output_unref);
|
||||
|
||||
if (s->silence.memblock)
|
||||
|
|
@ -2801,7 +2801,7 @@ pa_bool_t pa_source_check_format(pa_source *s, pa_format_info *f)
|
|||
}
|
||||
}
|
||||
|
||||
pa_idxset_free(formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -2831,7 +2831,7 @@ pa_idxset* pa_source_check_formats(pa_source *s, pa_idxset *in_formats) {
|
|||
|
||||
done:
|
||||
if (source_formats)
|
||||
pa_idxset_free(source_formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
|
||||
pa_idxset_free(source_formats, (pa_free_cb_t) pa_format_info_free);
|
||||
|
||||
return out_formats;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue