streamline deletion code

This commit is contained in:
matthias.ringwald 2010-06-13 21:27:47 +00:00
parent b63955969a
commit 69025de84f
2 changed files with 7 additions and 7 deletions

View File

@ -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;

View File

@ -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;
}