You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by ab...@apache.org on 2013/10/02 11:11:43 UTC

svn commit: r1528390 - /incubator/celix/trunk/framework/private/src/service_registry.c

Author: abroekhuis
Date: Wed Oct  2 09:11:42 2013
New Revision: 1528390

URL: http://svn.apache.org/r1528390
Log:
CELIX-56: Code changes according to the correct format

Modified:
    incubator/celix/trunk/framework/private/src/service_registry.c

Modified: incubator/celix/trunk/framework/private/src/service_registry.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_registry.c?rev=1528390&r1=1528389&r2=1528390&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_registry.c (original)
+++ incubator/celix/trunk/framework/private/src/service_registry.c Wed Oct  2 09:11:42 2013
@@ -43,6 +43,52 @@ celix_status_t serviceRegistry_removeHoo
 
 apr_status_t serviceRegistry_removeReference(void *referenceP);
 
+celix_status_t serviceRegistry_create(apr_pool_t *pool, framework_pt framework, serviceChanged_function_pt serviceChanged, service_registry_pt *registry) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	*registry = (service_registry_pt) apr_palloc(pool, (sizeof(**registry)));
+	if (!*registry) {
+		status = CELIX_ENOMEM;
+	} else {
+		apr_status_t aprStatus;
+
+		apr_pool_pre_cleanup_register(pool, *registry, serviceRegistry_destroy);
+
+		(*registry)->pool=pool;
+		(*registry)->serviceChanged = serviceChanged;
+		(*registry)->inUseMap = hashMap_create(NULL, NULL, NULL, NULL);
+		(*registry)->serviceRegistrations = hashMap_create(NULL, NULL, NULL, NULL);
+		(*registry)->framework = framework;
+		(*registry)->currentServiceId = 1l;
+
+		arrayList_create(pool, &(*registry)->listenerHooks);
+		aprStatus = apr_thread_mutex_create(&(*registry)->mutex, APR_THREAD_MUTEX_NESTED, pool);
+		if (aprStatus != APR_SUCCESS) {
+			status = CELIX_FRAMEWORK_EXCEPTION;
+		}
+	}
+
+	return status;
+}
+
+apr_status_t serviceRegistry_destroy(void *handle) {
+	service_registry_pt registry = (service_registry_pt) handle;
+    hashMap_destroy(registry->inUseMap, false, false);
+    hashMap_destroy(registry->serviceRegistrations, false, false);
+    arrayList_destroy(registry->listenerHooks);
+    apr_thread_mutex_destroy(registry->mutex);
+    registry->framework = NULL;
+    registry->inUseMap = NULL;
+    registry->listenerHooks = NULL;
+    registry->mutex = NULL;
+    registry->pool = NULL;
+    registry->serviceChanged = NULL;
+    registry->serviceReferences = NULL;
+    registry->serviceRegistrations = NULL;
+
+    return CELIX_SUCCESS;
+}
+
 celix_status_t serviceRegistry_getUsageCount(service_registry_pt registry, bundle_pt bundle, service_reference_pt reference, usage_count_pt *usageCount) {
 	array_list_pt usages = (array_list_pt) hashMap_get(registry->inUseMap, bundle);
 	*usageCount = NULL;
@@ -105,52 +151,6 @@ celix_status_t serviceRegistry_flushUsag
 	return CELIX_SUCCESS;
 }
 
-celix_status_t serviceRegistry_create(apr_pool_t *pool, framework_pt framework, serviceChanged_function_pt serviceChanged, service_registry_pt *registry) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	*registry = (service_registry_pt) apr_palloc(pool, (sizeof(**registry)));
-	if (!*registry) {
-		status = CELIX_ENOMEM;
-	} else {
-		apr_status_t aprStatus;
-
-		apr_pool_pre_cleanup_register(pool, *registry, serviceRegistry_destroy);
-
-		(*registry)->pool=pool;
-		(*registry)->serviceChanged = serviceChanged;
-		(*registry)->inUseMap = hashMap_create(NULL, NULL, NULL, NULL);
-		(*registry)->serviceRegistrations = hashMap_create(NULL, NULL, NULL, NULL);
-		(*registry)->framework = framework;
-		(*registry)->currentServiceId = 1l;
-
-		arrayList_create(pool, &(*registry)->listenerHooks);
-		aprStatus = apr_thread_mutex_create(&(*registry)->mutex, APR_THREAD_MUTEX_NESTED, pool);
-		if (aprStatus != APR_SUCCESS) {
-			status = CELIX_FRAMEWORK_EXCEPTION;
-		}
-	}
-
-	return status;
-}
-
-apr_status_t serviceRegistry_destroy(void *handle) {
-	service_registry_pt registry = (service_registry_pt) handle;
-    hashMap_destroy(registry->inUseMap, false, false);
-    hashMap_destroy(registry->serviceRegistrations, false, false);
-    arrayList_destroy(registry->listenerHooks);
-    apr_thread_mutex_destroy(registry->mutex);
-    registry->framework = NULL;
-    registry->inUseMap = NULL;
-    registry->listenerHooks = NULL;
-    registry->mutex = NULL;
-    registry->pool = NULL;
-    registry->serviceChanged = NULL;
-    registry->serviceReferences = NULL;
-    registry->serviceRegistrations = NULL;
-
-    return CELIX_SUCCESS;
-}
-
 celix_status_t serviceRegistry_getRegisteredServices(service_registry_pt registry, apr_pool_t *pool, bundle_pt bundle, array_list_pt *services) {
 	celix_status_t status = CELIX_SUCCESS;