use spa_list_append when we can

This commit is contained in:
Wim Taymans 2017-10-24 12:58:10 +02:00
parent 4aaa2cbc6b
commit a691d07531
21 changed files with 41 additions and 42 deletions

View file

@ -515,7 +515,7 @@ core_global_added(void *data, struct pw_global *global)
pw_client_add_listener(client, &cinfo->client_listener, &client_events, cinfo);
spa_list_insert(impl->client_list.prev, &cinfo->link);
spa_list_append(&impl->client_list, &cinfo->link);
pw_log_debug("module %p: client %p added", impl, client);
}

View file

@ -1055,7 +1055,7 @@ static struct client *client_new(struct impl *impl, int fd)
goto no_source;
spa_list_init(&this->jack_clients);
spa_list_insert(impl->client_list.prev, &this->link);
spa_list_append(&impl->client_list, &this->link);
pw_client_add_listener(client, &this->client_listener, &client_events, this);
@ -1426,7 +1426,7 @@ static bool add_socket(struct impl *impl, struct socket *s)
if (s->source == NULL)
return false;
spa_list_insert(impl->socket_list.prev, &s->link);
spa_list_append(&impl->socket_list, &s->link);
return true;
}

View file

@ -124,7 +124,7 @@ static void *object_new(size_t size,
this->skel = skel;
this->destroy = destroy;
spa_list_insert(impl->object_list.prev, &this->link);
spa_list_append(&impl->object_list, &this->link);
if (export)
object_export(this);
@ -243,7 +243,7 @@ static struct client *client_new(struct impl *impl, const char *sender)
client_name_appeared_handler,
client_name_vanished_handler, this, NULL);
spa_list_insert(impl->client_list.prev, &this->link);
spa_list_append(&impl->client_list, &this->link);
}
return this;
}

View file

@ -66,7 +66,7 @@ client_bind_func(struct pw_global *global,
pw_log_debug("client %p: bound to %d", this, resource->id);
spa_list_insert(this->resource_list.prev, &resource->link);
spa_list_append(&this->resource_list, &resource->link);
this->info.change_mask = ~0;
pw_client_resource_info(resource, &this->info);
@ -142,7 +142,7 @@ void pw_client_register(struct pw_client *client,
struct pw_core *core = client->core;
pw_log_debug("client %p: register parent %d", client, parent ? parent->id : SPA_ID_INVALID);
spa_list_insert(core->client_list.prev, &client->link);
spa_list_append(&core->client_list, &client->link);
client->global = pw_core_add_global(core, owner, parent, core->type.client, PW_VERSION_CLIENT,
client_bind_func, client);
client->info.id = client->global->id;

View file

@ -140,7 +140,7 @@ static void core_get_registry(void *object, uint32_t version, uint32_t new_id)
&registry_methods,
registry_resource);
spa_list_insert(this->registry_resource_list.prev, &registry_resource->link);
spa_list_append(&this->registry_resource_list, &registry_resource->link);
spa_list_for_each(global, &this->global_list, link) {
uint32_t permissions = pw_global_get_permissions(global, client);

View file

@ -97,7 +97,7 @@ factory_bind_func(struct pw_global *global,
pw_log_debug("factory %p: bound to %d", this, resource->id);
spa_list_insert(this->resource_list.prev, &resource->link);
spa_list_append(&this->resource_list, &resource->link);
this->info.change_mask = ~0;
pw_factory_resource_info(resource, &this->info);

View file

@ -93,7 +93,7 @@ pw_core_add_global(struct pw_core *core,
parent = this;
this->parent = parent;
spa_list_insert(core->global_list.prev, &this->link);
spa_list_append(&core->global_list, &this->link);
spa_hook_list_call(&core->listener_list, struct pw_core_events, global_added, this);

View file

@ -996,7 +996,7 @@ link_bind_func(struct pw_global *global,
pw_log_debug("link %p: bound to %d", this, resource->id);
spa_list_insert(this->resource_list.prev, &resource->link);
spa_list_append(&this->resource_list, &resource->link);
this->info.change_mask = ~0;
pw_link_resource_info(resource, &this->info);
@ -1114,8 +1114,8 @@ struct pw_link *pw_link_new(struct pw_core *core,
pw_log_debug("link %p: output node %p clock %p, live %d", this, output_node, output_node->clock,
output_node->live);
spa_list_insert(output->links.prev, &this->output_link);
spa_list_insert(input->links.prev, &this->input_link);
spa_list_append(&output->links, &this->output_link);
spa_list_append(&input->links, &this->input_link);
this->info.output_node_id = output_node->global->id;
this->info.output_port_id = output->port_id;
@ -1169,7 +1169,7 @@ void pw_link_register(struct pw_link *link,
struct pw_core *core = link->core;
struct pw_node *input_node, *output_node;
spa_list_insert(core->link_list.prev, &link->link);
spa_list_append(&core->link_list, &link->link);
link->global = pw_core_add_global(core, owner, parent, core->type.link, PW_VERSION_LINK,
link_bind_func, link);
link->info.id = link->global->id;

View file

@ -303,7 +303,7 @@ node_bind_func(struct pw_global *global,
pw_log_debug("node %p: bound to %d", this, resource->id);
spa_list_insert(this->resource_list.prev, &resource->link);
spa_list_append(&this->resource_list, &resource->link);
this->info.change_mask = ~0;
pw_node_resource_info(resource, &this->info);
@ -343,7 +343,7 @@ void pw_node_register(struct pw_node *this,
pw_loop_invoke(this->data_loop, do_node_add, 1, 0, NULL, false, this);
spa_list_insert(core->node_list.prev, &this->link);
spa_list_append(&core->node_list, &this->link);
this->global = pw_core_add_global(core, owner, parent,
core->type.node, PW_VERSION_NODE,
node_bind_func, this);

View file

@ -50,7 +50,7 @@ struct pw_protocol *pw_protocol_new(struct pw_core *core,
if (user_data_size > 0)
protocol->user_data = SPA_MEMBER(protocol, sizeof(struct impl), void);
spa_list_insert(core->protocol_list.prev, &protocol->link);
spa_list_append(&core->protocol_list, &protocol->link);
pw_log_info("protocol %p: Created protocol %s", protocol, name);
@ -118,7 +118,7 @@ pw_protocol_add_marshal(struct pw_protocol *protocol,
impl->marshal = marshal;
impl->type = spa_type_map_get_id (protocol->core->type.map, marshal->type);
spa_list_insert(protocol->marshal_list.prev, &impl->link);
spa_list_append(&protocol->marshal_list, &impl->link);
pw_log_info("Add marshal %s:%d to protocol %s", marshal->type, marshal->version,
protocol->name);

View file

@ -68,7 +68,7 @@ struct pw_proxy *pw_proxy_new(struct pw_proxy *factory,
this->marshal = pw_protocol_get_marshal(remote->conn->protocol, type);
spa_list_insert(&this->remote->proxy_list, &this->link);
spa_list_append(&this->remote->proxy_list, &this->link);
pw_log_debug("proxy %p: new %u, remote %p, marshal %p", this, this->id, remote, this->marshal);

View file

@ -241,7 +241,7 @@ struct pw_stream *pw_stream_new(struct pw_remote *remote,
impl->pending_seq = SPA_ID_INVALID;
spa_list_init(&impl->free);
spa_list_insert(&remote->stream_list, &this->link);
spa_list_append(&remote->stream_list, &this->link);
return this;
@ -511,7 +511,7 @@ static inline void reuse_buffer(struct pw_stream *stream, uint32_t id)
if ((bid = find_buffer(stream, id)) && bid->used) {
pw_log_trace("stream %p: reuse buffer %u", stream, id);
bid->used = false;
spa_list_insert(impl->free.prev, &bid->link);
spa_list_append(&impl->free, &bid->link);
spa_hook_list_call(&stream->listener_list, struct pw_stream_events, new_buffer, id);
}
}
@ -799,7 +799,7 @@ client_node_use_buffers(void *data,
bid = pw_array_add(&impl->buffer_ids, sizeof(struct buffer_id));
if (impl->direction == SPA_DIRECTION_OUTPUT) {
bid->used = false;
spa_list_insert(impl->free.prev, &bid->link);
spa_list_append(&impl->free, &bid->link);
} else {
bid->used = true;
}
@ -1085,7 +1085,7 @@ bool pw_stream_recycle_buffer(struct pw_stream *stream, uint32_t id)
return false;
bid->used = false;
spa_list_insert(impl->free.prev, &bid->link);
spa_list_append(&impl->free, &bid->link);
pw_client_node_transport_add_message(impl->trans, (struct pw_client_node_message*)
&PW_CLIENT_NODE_MESSAGE_REUSE_BUFFER_INIT(impl->port_id, id));

View file

@ -73,7 +73,7 @@ static void process_work_queue(void *data, uint64_t count)
this->n_queued, item->obj, item->seq, item->res);
item->func(item->obj, item->data, item->res, item->id);
}
spa_list_insert(this->free_list.prev, &item->link);
spa_list_append(&this->free_list, &item->link);
}
}
@ -169,7 +169,7 @@ pw_work_queue_add(struct pw_work_queue *queue, void *obj, int res, pw_work_func_
have_work = true;
pw_log_debug("work-queue %p: defer object %p", queue, obj);
}
spa_list_insert(queue->work_list.prev, &item->link);
spa_list_append(&queue->work_list, &item->link);
queue->n_queued++;
if (have_work)