mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-27 06:35:20 +00:00
streamline deletion code
This commit is contained in:
parent
b63955969a
commit
69025de84f
@ -706,11 +706,11 @@ void l2cap_close_connection(connection_t *connection){
|
||||
}
|
||||
|
||||
// unregister services
|
||||
l2cap_service_t *service;
|
||||
for (it = (linked_item_t *) &l2cap_services; it->next; ){
|
||||
service = (l2cap_service_t *) it->next;
|
||||
it = (linked_item_t *) &l2cap_services;
|
||||
while (it->next){
|
||||
l2cap_service_t * service = (l2cap_service_t *) it->next;
|
||||
if (service->connection == connection){
|
||||
it->next = service->item.next;
|
||||
it->next = it->next->next;
|
||||
free(service);
|
||||
} else {
|
||||
it = it->next;
|
||||
|
@ -184,10 +184,10 @@ void sdp_unregister_service_internal(connection_t *connection, uint32_t service_
|
||||
void sdp_unregister_services_for_connection(connection_t *connection){
|
||||
linked_item_t *it = (linked_item_t *) &sdp_service_records;
|
||||
while (it->next){
|
||||
if (((service_record_item_t *)(it->next))->connection == connection){
|
||||
linked_item_t *toDelete = it->next;
|
||||
service_record_item_t *record_item = (service_record_item_t *) it->next;
|
||||
if (record_item->connection == connection){
|
||||
it->next = it->next->next;
|
||||
free(toDelete);
|
||||
free(record_item);
|
||||
} else {
|
||||
it = it->next;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user