celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [37/50] [abbrv] celix git commit: CELIX-269: Changed the component add service dependency function from vararg to non vararg
Date Tue, 03 Nov 2015 15:10:03 GMT
CELIX-269: Changed the component add service dependency function from vararg to non vararg


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/02c56310
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/02c56310
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/02c56310

Branch: refs/heads/master
Commit: 02c56310348cf341c0d4c2bf43c6a373fcb05246
Parents: d040f00
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Thu Oct 29 16:43:50 2015 +0100
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Thu Oct 29 16:43:50 2015 +0100

----------------------------------------------------------------------
 dependency_manager/private/src/dm_component_impl.c        | 10 +++++++---
 dependency_manager/public/include/dm_component.h          |  2 +-
 .../tracker_depman/private/src/dependency_activator.c     |  4 ++--
 3 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/02c56310/dependency_manager/private/src/dm_component_impl.c
----------------------------------------------------------------------
diff --git a/dependency_manager/private/src/dm_component_impl.c b/dependency_manager/private/src/dm_component_impl.c
index ec13933..a36e232 100644
--- a/dependency_manager/private/src/dm_component_impl.c
+++ b/dependency_manager/private/src/dm_component_impl.c
@@ -166,23 +166,25 @@ celix_status_t component_destroy(dm_component_pt *component_ptr) {
 	return status;
 }
 
-celix_status_t component_addServiceDependency(dm_component_pt component, ...) {
+celix_status_t component_addServiceDependency(dm_component_pt component, dm_service_dependency_pt
dep) {
     celix_status_t status = CELIX_SUCCESS;
 
     array_list_pt dependenciesList = NULL;
     arrayList_create(&dependenciesList);
+    arrayList_add(dependenciesList, dep);
 
+    /*
     va_list dependencies;
     va_start(dependencies, component);
     dm_service_dependency_pt dependency = va_arg(dependencies, dm_service_dependency_pt);
     while (dependency != NULL) {
         arrayList_add(dependenciesList, dependency);
 
-
         dependency = va_arg(dependencies, dm_service_dependency_pt);
     }
 
     va_end(dependencies);
+     */
 
 	executor_executeTask(component->executor, component, component_addTask, dependenciesList);
 //    component_addTask(component, dependenciesList);
@@ -1351,12 +1353,14 @@ celix_status_t component_getComponentInfo(dm_component_pt component,
dm_componen
 
     celixThreadMutex_lock(&component->mutex);
     size = arrayList_size(component->dependencies);
-    for (i = 0; status == CELIX_SUCCESS && i < size; i += 1) {
+    for (i = 0; i < size; i += 1) {
         dm_service_dependency_pt dep = arrayList_get(component->dependencies, i);
         dm_service_dependency_info_pt depInfo= NULL;
         status = serviceDependency_getServiceDependencyInfo(dep, &depInfo);
         if (status == CELIX_SUCCESS) {
             arrayList_add(info->dependency_list, depInfo);
+        } else {
+            break;
         }
     }
     celixThreadMutex_unlock(&component->mutex);

http://git-wip-us.apache.org/repos/asf/celix/blob/02c56310/dependency_manager/public/include/dm_component.h
----------------------------------------------------------------------
diff --git a/dependency_manager/public/include/dm_component.h b/dependency_manager/public/include/dm_component.h
index 12dbcca..cf709cd 100644
--- a/dependency_manager/public/include/dm_component.h
+++ b/dependency_manager/public/include/dm_component.h
@@ -55,7 +55,7 @@ celix_status_t component_setImplementation(dm_component_pt component, void
*impl
  */
 celix_status_t component_getInterfaces(dm_component_pt component, array_list_pt *servicesNames);
 
-celix_status_t component_addServiceDependency(dm_component_pt component, ...);
+celix_status_t component_addServiceDependency(dm_component_pt component, dm_service_dependency_pt
dep);
 celix_status_t component_removeServiceDependency(dm_component_pt component, dm_service_dependency_pt
dependency);
 
 celix_status_t component_setCallbacks(dm_component_pt component, init_fpt init, start_fpt
start, stop_fpt stop, deinit_fpt deinit);

http://git-wip-us.apache.org/repos/asf/celix/blob/02c56310/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
----------------------------------------------------------------------
diff --git a/examples/whiteboard/tracker_depman/private/src/dependency_activator.c b/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
index 4e36321..2ce9bab 100644
--- a/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
+++ b/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
@@ -62,14 +62,14 @@ celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency
 	serviceDependency_setRequired(dep1, true);
 	serviceDependency_setService(dep1, PUBLISHER_NAME, "(|(id=A)(id=B))");
 	serviceDependency_setCallbacksWithServiceReference(dep1, NULL /*tracker_setServ*/, tracker_addedServ,
tracker_modifiedServ, tracker_removedServ, NULL);
-	component_addServiceDependency(service, dep1, NULL);
+	component_addServiceDependency(service, dep1);
 
 	serviceDependency_create(&dep2);
     serviceDependency_setRequired(dep2, false);
     serviceDependency_setService(dep2, (char *) OSGI_LOGSERVICE_NAME, NULL);
     serviceDependency_setCallbacksWithServiceReference(dep2, NULL  /*tracker_setLog*/, tracker_addLog,
tracker_modifiedLog, tracker_removeLog, NULL);
 	serviceDependency_setAutoConfigure(dep2, &data->logger_lock, (void **) &data->logger);
-    component_addServiceDependency(service, dep2, NULL);
+    component_addServiceDependency(service, dep2);
 
 	data->service = service;
 	data->dep = dep1;


Mime
View raw message