There were no users for the userdata pointer.
pa_assert(s);
if (s->options)
- pa_idxset_free(s->options, NULL, NULL);
+ pa_idxset_free(s->options, NULL);
pa_xfree(s->name);
pa_xfree(s->description);
pa_xstrfreev(p->output_mapping_names);
if (p->input_mappings)
- pa_idxset_free(p->input_mappings, NULL, NULL);
+ pa_idxset_free(p->input_mappings, NULL);
if (p->output_mappings)
- pa_idxset_free(p->output_mappings, NULL, NULL);
+ pa_idxset_free(p->output_mappings, NULL);
pa_xfree(p);
}
return FALSE;
}
- pa_idxset_free(u->formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
+ pa_idxset_free(u->formats, (pa_free_cb_t) pa_format_info_free);
u->formats = pa_idxset_new(NULL, NULL);
/* Note: the logic below won't apply if we're using software encoding.
pa_smoother_free(u->smoother);
if (u->formats)
- pa_idxset_free(u->formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
+ pa_idxset_free(u->formats, (pa_free_cb_t) pa_format_info_free);
if (u->rates)
pa_xfree(u->rates);
PA_LLIST_REMOVE(pa_alsa_ucm_device, verb->devices, di);
pa_proplist_free(di->proplist);
if (di->conflicting_devices)
- pa_idxset_free(di->conflicting_devices, NULL, NULL);
+ pa_idxset_free(di->conflicting_devices, NULL);
if (di->supported_devices)
- pa_idxset_free(di->supported_devices, NULL, NULL);
+ pa_idxset_free(di->supported_devices, NULL);
pa_xfree(di);
}
dev->capture_mapping = NULL;
}
- pa_idxset_free(context->ucm_devices, NULL, NULL);
+ pa_idxset_free(context->ucm_devices, NULL);
}
if (context->ucm_modifiers) {
mod->capture_mapping = NULL;
}
- pa_idxset_free(context->ucm_modifiers, NULL, NULL);
+ pa_idxset_free(context->ucm_modifiers, NULL);
}
}
void pa__done(pa_module *m) {
struct userdata *u;
- struct connection *c;
pa_assert(m);
if (u->core_iface)
pa_dbusiface_core_free(u->core_iface);
- if (u->connections) {
- while ((c = pa_idxset_steal_first(u->connections, NULL)))
- connection_free(c);
-
- pa_idxset_free(u->connections, NULL, NULL);
- }
+ if (u->connections)
+ pa_idxset_free(u->connections, (pa_free_cb_t) connection_free);
/* This must not be called before the connections are freed, because if
* there are any connections left, they will emit the
pa_assert_se(o = i->userdata);
pa_module_unload_request(o->userdata->module, TRUE);
+ pa_idxset_remove_by_data(o->userdata->outputs, o, NULL);
output_free(o);
}
if (!u->automatic)
u->unlinked_slaves = pa_strlist_prepend(u->unlinked_slaves, s->name);
+ pa_idxset_remove_by_data(u->outputs, o, NULL);
output_free(o);
return PA_HOOK_OK;
void pa__done(pa_module*m) {
struct userdata *u;
- struct output *o;
pa_assert(m);
if (u->sink_state_changed_slot)
pa_hook_slot_free(u->sink_state_changed_slot);
- if (u->outputs) {
- while ((o = pa_idxset_first(u->outputs, NULL)))
- output_free(o);
-
- pa_idxset_free(u->outputs, NULL, NULL);
- }
+ if (u->outputs)
+ pa_idxset_free(u->outputs, (pa_free_cb_t) output_free);
if (u->sink)
pa_sink_unlink(u->sink);
}
if (u->subscribed)
- pa_idxset_free(u->subscribed, NULL, NULL);
+ pa_idxset_free(u->subscribed, NULL);
pa_xfree(u);
}
static void perportentry_free(struct perportentry* e) {
pa_assert(e);
- pa_idxset_free(e->formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
+ pa_idxset_free(e->formats, (pa_free_cb_t) pa_format_info_free);
pa_xfree(e);
}
e = perportentry_new(FALSE);
else {
/* Clean out any saved formats */
- pa_idxset_free(e->formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
+ pa_idxset_free(e->formats, (pa_free_cb_t) pa_format_info_free);
e->formats = pa_idxset_new(NULL, NULL);
}
}
if (u->subscribed)
- pa_idxset_free(u->subscribed, NULL, NULL);
+ pa_idxset_free(u->subscribed, NULL);
pa_xfree(u);
}
void pa__done(pa_module *m) {
struct userdata* u;
- char *role;
pa_assert(m);
if (!(u = m->userdata))
return;
- if (u->trigger_roles) {
- while ((role = pa_idxset_steal_first(u->trigger_roles, NULL)))
- pa_xfree(role);
- pa_idxset_free(u->trigger_roles, NULL, NULL);
- }
- if (u->cork_roles) {
- while ((role = pa_idxset_steal_first(u->cork_roles, NULL)))
- pa_xfree(role);
- pa_idxset_free(u->cork_roles, NULL, NULL);
- }
+ if (u->trigger_roles)
+ pa_idxset_free(u->trigger_roles, pa_xfree);
+
+ if (u->cork_roles)
+ pa_idxset_free(u->cork_roles, pa_xfree);
if (u->sink_input_put_slot)
pa_hook_slot_free(u->sink_input_put_slot);
void pa__done(pa_module *m) {
struct userdata* u;
pa_sink_input *i;
- char *role;
pa_assert(m);
if (!(u = m->userdata))
return;
- if (u->trigger_roles) {
- while ((role = pa_idxset_steal_first(u->trigger_roles, NULL)))
- pa_xfree(role);
- pa_idxset_free(u->trigger_roles, NULL, NULL);
- }
- if (u->ducking_roles) {
- while ((role = pa_idxset_steal_first(u->ducking_roles, NULL)))
- pa_xfree(role);
- pa_idxset_free(u->ducking_roles, NULL, NULL);
- }
+ if (u->trigger_roles)
+ pa_idxset_free(u->trigger_roles, pa_xfree);
+
+ if (u->ducking_roles)
+ pa_idxset_free(u->ducking_roles, pa_xfree);
+
if (u->ducked_inputs) {
while ((i = pa_idxset_steal_first(u->ducked_inputs, NULL)))
pa_sink_input_remove_volume_factor(i, u->name);
- pa_idxset_free(u->ducked_inputs, NULL, NULL);
+ pa_idxset_free(u->ducked_inputs, NULL);
}
if (u->sink_input_put_slot)
}
if (u->subscribed)
- pa_idxset_free(u->subscribed, NULL, NULL);
+ pa_idxset_free(u->subscribed, NULL);
pa_xfree(u);
}
pa_xfree(f);
}
-void pa_format_info_free2(pa_format_info *f, void *userdata) {
- pa_format_info_free(f);
-}
-
int pa_format_info_valid(const pa_format_info *f) {
return (f->encoding >= 0 && f->encoding < PA_ENCODING_MAX && f->plist != NULL);
}
void pa_ext_device_restore_command(pa_context *c, uint32_t tag, pa_tagstruct *t);
void pa_ext_stream_restore_command(pa_context *c, uint32_t tag, pa_tagstruct *t);
-void pa_format_info_free2(pa_format_info *f, void *userdata);
-
pa_bool_t pa_mainloop_is_our_api(pa_mainloop_api*m);
#endif
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);
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);
* 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);
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) {
remove_entry(s, s->iterate_list_head);
if (free_cb)
- free_cb(data, userdata);
+ free_cb(data);
}
pa_xfree(s);
#include <inttypes.h>
+#include <pulse/def.h>
+
#include <pulsecore/macro.h>
/* A combination of a set and a dynamic array. Entries are indexable
/* 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. */
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);
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);
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]);
}
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);
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);
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);
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);
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;
}
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);
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) {
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) {
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);
}
}
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);
}
}
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);
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);
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;
}
}
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;
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);
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);
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)
}
}
- 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;
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;
}
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;
}
}
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;
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);
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)
}
}
- 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;
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;
}