celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [43/50] celix git commit: CELIX-347: Improves dependency manager linking, so library with undefined symbols are not expected (for Linux)
Date Mon, 11 Apr 2016 10:55:10 GMT
CELIX-347: Improves dependency manager linking, so library with undefined symbols are not expected
(for Linux)


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

Branch: refs/heads/release/celix-2.0.0
Commit: 0251da239366df133b4f23cc7b0529df7eb82a45
Parents: 90adc1f
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Tue Feb 16 14:56:18 2016 +0100
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Tue Feb 16 14:56:18 2016 +0100

----------------------------------------------------------------------
 dependency_manager/private/src/dm_service_dependency.c | 10 ++++++++--
 examples/dm_example/phase1/CMakeLists.txt              |  4 ++--
 examples/dm_example/phase2a/CMakeLists.txt             |  4 ++--
 examples/dm_example/phase2b/CMakeLists.txt             |  4 ++--
 examples/dm_example/phase3/CMakeLists.txt              |  4 ++--
 5 files changed, 16 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/0251da23/dependency_manager/private/src/dm_service_dependency.c
----------------------------------------------------------------------
diff --git a/dependency_manager/private/src/dm_service_dependency.c b/dependency_manager/private/src/dm_service_dependency.c
index 4e77175..f81bd93 100644
--- a/dependency_manager/private/src/dm_service_dependency.c
+++ b/dependency_manager/private/src/dm_service_dependency.c
@@ -229,10 +229,16 @@ celix_status_t serviceDependency_setService(dm_service_dependency_pt
dependency,
 
             while (arrayListIterator_hasNext(filterElementsIter) == true) {
                 char* filterElement = (char*) arrayListIterator_next(filterElementsIter);
-                size_t len = strlen(dependency->tracked_filter) + strlen(filterElement)
+ 4;
+                size_t len = strnlen(dependency->tracked_filter, 1024*1024) + strnlen(filterElement,
1024*1024) + 4;
                 char* newFilter = calloc(len, sizeof(*newFilter));
 
-                snprintf(newFilter, len, "(&%s%s)", dependency->tracked_filter, filterElement);
+                if (dependency->tracked_filter[0] == '(' && dependency->tracked_filter[1]
== '&') {
+                    //already have an & (AND) can combine with additional filter ->
easier to read
+                    size_t orgLen = strnlen(dependency->tracked_filter, 1024*1024);
+                    snprintf(newFilter, len, "%.*s%s)", (int)orgLen -1, dependency->tracked_filter,
filterElement);
+                } else {
+                    snprintf(newFilter, len, "(&%s%s)", dependency->tracked_filter,
filterElement);
+                }
 
                 free(dependency->tracked_filter);
                 free(filterElement);

http://git-wip-us.apache.org/repos/asf/celix/blob/0251da23/examples/dm_example/phase1/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase1/CMakeLists.txt b/examples/dm_example/phase1/CMakeLists.txt
index d61fc77..b8c34b3 100644
--- a/examples/dm_example/phase1/CMakeLists.txt
+++ b/examples/dm_example/phase1/CMakeLists.txt
@@ -32,7 +32,7 @@ add_bundle(phase1
 #bundle_private_libs(phase1 dependency_manager)
 
 IF(APPLE)
-target_link_libraries(phase1 celix_framework -Wl,-all_load dependency_manager_static)
+    target_link_libraries(phase1 celix_framework -Wl,-all_load dependency_manager_static)
 else()
-target_link_libraries(phase1 -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive
celix_framework)
+    target_link_libraries(phase1 -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static
-Wl,--no-whole-archive celix_framework)
 ENDIF()

http://git-wip-us.apache.org/repos/asf/celix/blob/0251da23/examples/dm_example/phase2a/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2a/CMakeLists.txt b/examples/dm_example/phase2a/CMakeLists.txt
index 0884250..5474534 100644
--- a/examples/dm_example/phase2a/CMakeLists.txt
+++ b/examples/dm_example/phase2a/CMakeLists.txt
@@ -29,7 +29,7 @@ add_bundle(phase2a
 )
 
 IF(APPLE)
-target_link_libraries(phase2a celix_framework -Wl,-all_load dependency_manager_static)
+    target_link_libraries(phase2a celix_framework -Wl,-all_load dependency_manager_static)
 else()
-target_link_libraries(phase2a -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive
celix_framework)
+    target_link_libraries(phase2a -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static
-Wl,--no-whole-archive celix_framework)
 ENDIF()

http://git-wip-us.apache.org/repos/asf/celix/blob/0251da23/examples/dm_example/phase2b/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase2b/CMakeLists.txt b/examples/dm_example/phase2b/CMakeLists.txt
index 5bd2a6e..ff3089c 100644
--- a/examples/dm_example/phase2b/CMakeLists.txt
+++ b/examples/dm_example/phase2b/CMakeLists.txt
@@ -31,7 +31,7 @@ add_bundle(phase2b
 #bundle_private_libs(phase2b dependency_manager)
 
 IF(APPLE)
-target_link_libraries(phase2b celix_framework -Wl,-all_load dependency_manager_static)
+    target_link_libraries(phase2b celix_framework -Wl,-all_load dependency_manager_static)
 else()
-target_link_libraries(phase2b -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive
celix_framework)
+    target_link_libraries(phase2b -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static
-Wl,--no-whole-archive celix_framework)
 ENDIF()

http://git-wip-us.apache.org/repos/asf/celix/blob/0251da23/examples/dm_example/phase3/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example/phase3/CMakeLists.txt b/examples/dm_example/phase3/CMakeLists.txt
index ba195cd..71d31c0 100644
--- a/examples/dm_example/phase3/CMakeLists.txt
+++ b/examples/dm_example/phase3/CMakeLists.txt
@@ -31,7 +31,7 @@ add_bundle(phase3
 #bundle_private_libs(phase3 dependency_manager)
 
 IF(APPLE)
-target_link_libraries(phase3 celix_framework -Wl,-all_load dependency_manager_static)
+    target_link_libraries(phase3 celix_framework -Wl,-all_load dependency_manager_static)
 else()
-target_link_libraries(phase3 -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive
celix_framework)
+    target_link_libraries(phase3 -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static
-Wl,--no-whole-archive celix_framework)
 ENDIF()


Mime
View raw message