Skip to content

Commit

Permalink
[CID 339894]Remove dead code.
Browse files Browse the repository at this point in the history
  • Loading branch information
PengZheng committed Jan 7, 2024
1 parent 7259275 commit 2070f58
Showing 1 changed file with 15 additions and 22 deletions.
37 changes: 15 additions & 22 deletions libs/framework/src/service_registry.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,37 +677,30 @@ size_t serviceRegistry_nrOfHooks(service_registry_pt registry) {
}

static celix_status_t serviceRegistry_getUsingBundles(service_registry_pt registry, service_registration_pt registration, celix_array_list_t** out) {
celix_status_t status = CELIX_SUCCESS;
celix_array_list_t* bundles = NULL;
hash_map_iterator_pt iter;

bundles = celix_arrayList_create();
if (bundles) {
celixThreadRwlock_readLock(&registry->lock);
iter = hashMapIterator_create(registry->serviceReferences);
while (hashMapIterator_hasNext(iter)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
bundle_pt registrationUser = hashMapEntry_getKey(entry);
hash_map_pt regMap = hashMapEntry_getValue(entry);
if (hashMap_containsKey(regMap, (void*)registration->serviceId)) {
celix_arrayList_add(bundles, registrationUser);
}
}
hashMapIterator_destroy(iter);
celixThreadRwlock_unlock(&registry->lock);
} else {
status = CELIX_ENOMEM;
if (bundles == NULL) {
return CELIX_ENOMEM;
}

if (status == CELIX_SUCCESS) {
*out = bundles;
} else {
if (bundles != NULL) {
celix_arrayList_destroy(bundles);
celixThreadRwlock_readLock(&registry->lock);
iter = hashMapIterator_create(registry->serviceReferences);
while (hashMapIterator_hasNext(iter)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
bundle_pt registrationUser = hashMapEntry_getKey(entry);
hash_map_pt regMap = hashMapEntry_getValue(entry);
if (hashMap_containsKey(regMap, (void*)registration->serviceId)) {
celix_arrayList_add(bundles, registrationUser);
}
}
hashMapIterator_destroy(iter);
celixThreadRwlock_unlock(&registry->lock);

return status;
*out = bundles;

return CELIX_SUCCESS;
}

celix_status_t
Expand Down

0 comments on commit 2070f58

Please sign in to comment.