You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pe...@apache.org on 2024/01/07 03:28:46 UTC
(celix) 01/01: [CID 339894]Remove dead code.
This is an automated email from the ASF dual-hosted git repository.
pengzheng pushed a commit to branch hotfix/coverity
in repository https://gitbox.apache.org/repos/asf/celix.git
commit 2070f5835cb88ffe7aaabfb48e92f6217417c03e
Author: PengZheng <ho...@gmail.com>
AuthorDate: Sun Jan 7 11:28:34 2024 +0800
[CID 339894]Remove dead code.
---
libs/framework/src/service_registry.c | 37 ++++++++++++++---------------------
1 file changed, 15 insertions(+), 22 deletions(-)
diff --git a/libs/framework/src/service_registry.c b/libs/framework/src/service_registry.c
index 4957214c..467925bb 100644
--- a/libs/framework/src/service_registry.c
+++ b/libs/framework/src/service_registry.c
@@ -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(®istry->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(®istry->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(®istry->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(®istry->lock);
- return status;
+ *out = bundles;
+
+ return CELIX_SUCCESS;
}
celix_status_t