celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpe...@apache.org
Subject celix git commit: CELIX-236: fixed some minor issues in test implementation, converted thread initialization to be compatible with ISO C++
Date Tue, 06 Oct 2015 07:21:19 GMT
Repository: celix
Updated Branches:
  refs/heads/develop 80b9ec144 -> ebbe2023d


CELIX-236: fixed some minor issues in test implementation, converted thread initialization
to be compatible with ISO C++


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

Branch: refs/heads/develop
Commit: ebbe2023dcfff7e31429307fec0f619495d6a685
Parents: 80b9ec1
Author: Bjoern Petri <bpetri@apache.org>
Authored: Tue Oct 6 09:20:19 2015 +0200
Committer: Bjoern Petri <bpetri@apache.org>
Committed: Tue Oct 6 09:20:19 2015 +0200

----------------------------------------------------------------------
 utils/private/test/array_list_test.cpp    |  6 ++----
 utils/private/test/celix_threads_test.cpp | 16 +++++++++-------
 utils/private/test/hash_map_test.cpp      |  4 ++--
 utils/public/include/celix_threads.h      |  2 +-
 4 files changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/ebbe2023/utils/private/test/array_list_test.cpp
----------------------------------------------------------------------
diff --git a/utils/private/test/array_list_test.cpp b/utils/private/test/array_list_test.cpp
index fbf09a9..8a2a04e 100644
--- a/utils/private/test/array_list_test.cpp
+++ b/utils/private/test/array_list_test.cpp
@@ -80,11 +80,10 @@ TEST(array_list, create) {
 }
 
 TEST(array_list, trimToSize) {
-	bool added;
 	char * entry = my_strdup("entry");
 	arrayList_clear(list);
 
-	added = arrayList_add(list, entry);
+	arrayList_add(list, entry);
 	LONGS_EQUAL(1, list->size);
 	LONGS_EQUAL(10, list->capacity);
 
@@ -103,9 +102,8 @@ TEST(array_list, ensureCapacity) {
 	LONGS_EQUAL(0, list->size);
 
 	for (i = 0; i < 100; i++) {
-		bool added;
 		char * entry = my_strdup("entry");
-		added = arrayList_add(list, entry);
+		arrayList_add(list, entry);
 	}
 	LONGS_EQUAL(133, list->capacity);
 	LONGS_EQUAL(100, list->size);

http://git-wip-us.apache.org/repos/asf/celix/blob/ebbe2023/utils/private/test/celix_threads_test.cpp
----------------------------------------------------------------------
diff --git a/utils/private/test/celix_threads_test.cpp b/utils/private/test/celix_threads_test.cpp
index b0ddd83..d5a01b4 100644
--- a/utils/private/test/celix_threads_test.cpp
+++ b/utils/private/test/celix_threads_test.cpp
@@ -276,22 +276,24 @@ TEST(celix_thread_condition, broadcast) {
 static void * thread_test_func_create(void * arg) {
 	char ** test_str = (char**) arg;
 	*test_str = my_strdup("SUCCESS");
-	celixThread_exit(NULL);
+
+	return NULL;
 }
 
 static void * thread_test_func_exit(void *) {
 	int *pi = (int*) calloc(1, sizeof(int));
 	*pi = 666;
-	celixThread_exit(pi);
+
+	return pi;
 }
 
 static void * thread_test_func_detach(void *) {
-	celixThread_exit(NULL);
+	return NULL;
 }
 
 static void * thread_test_func_self(void * arg) {
 	*((celix_thread*) arg) = celixThread_self();
-	celixThread_exit(NULL);
+	return NULL;
 }
 
 static void * thread_test_func_lock(void *arg) {
@@ -303,7 +305,7 @@ static void * thread_test_func_lock(void *arg) {
 	celixThreadMutex_unlock(&param->mu);
 	celixThreadMutex_unlock(&param->mu2);
 
-	celixThread_exit(NULL);
+	return NULL;
 }
 
 static void * thread_test_func_cond_wait(void *arg) {
@@ -315,7 +317,7 @@ static void * thread_test_func_cond_wait(void *arg) {
 
 	celixThreadCondition_signal(&param->cond);
 	celixThreadMutex_unlock(&param->mu);
-	celixThread_exit(NULL);
+	return NULL;
 }
 
 static void * thread_test_func_cond_broadcast(void *arg) {
@@ -327,7 +329,7 @@ static void * thread_test_func_cond_broadcast(void *arg) {
 	celixThreadMutex_lock(&param->mu2);
 	param->i++;
 	celixThreadMutex_unlock(&param->mu2);
-	celixThread_exit(NULL);
+	return NULL;
 }
 
 static int thread_test_func_recur_lock(celix_thread_mutex_t *mu, int i) {

http://git-wip-us.apache.org/repos/asf/celix/blob/ebbe2023/utils/private/test/hash_map_test.cpp
----------------------------------------------------------------------
diff --git a/utils/private/test/hash_map_test.cpp b/utils/private/test/hash_map_test.cpp
index 1ef9337..024655d 100644
--- a/utils/private/test/hash_map_test.cpp
+++ b/utils/private/test/hash_map_test.cpp
@@ -66,7 +66,7 @@ unsigned int test_hashKeyChar(void * k) {
 
 	unsigned int hash = 1315423911;
 	unsigned int i    = 0;
-	int len = strlen(str);
+	unsigned int len = strlen(str);
 
 	for(i = 0; i < len; str++, i++)
 	{
@@ -77,6 +77,7 @@ unsigned int test_hashKeyChar(void * k) {
 }
 
 unsigned int test_hashValueChar(void * v) {
+	(void)(v);
 	return 0;
 }
 
@@ -381,7 +382,6 @@ TEST(hash_map, put){
 
 TEST(hash_map, resize){
 	int i;
-	char * k;
 	char key[6];
 
 	LONGS_EQUAL(0, map->size);

http://git-wip-us.apache.org/repos/asf/celix/blob/ebbe2023/utils/public/include/celix_threads.h
----------------------------------------------------------------------
diff --git a/utils/public/include/celix_threads.h b/utils/public/include/celix_threads.h
index 242842b..253ebf8 100644
--- a/utils/public/include/celix_threads.h
+++ b/utils/public/include/celix_threads.h
@@ -44,7 +44,7 @@ typedef pthread_attr_t celix_thread_attr_t;
 
 typedef void *(*celix_thread_start_t)(void*);
 
-static const celix_thread_t celix_thread_default = { .threadInitialized = false };
+static const celix_thread_t celix_thread_default = { 0, 0 };
 
 
 celix_status_t celixThread_create(celix_thread_t *new_thread, celix_thread_attr_t *attr,
celix_thread_start_t func, void *data);


Mime
View raw message