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 2015/03/18 21:27:30 UTC
svn commit: r1667610 - in /celix/trunk: dependency_manager/
deployment_admin/META-INF/ examples/
examples/echo_service/client/private/src/
examples/echo_service/server/private/src/ examples/hello_world/private/src/
examples/hello_world_test/private/src...
Author: abroekhuis
Date: Wed Mar 18 20:27:29 2015
New Revision: 1667610
URL: http://svn.apache.org/r1667610
Log:
Fixed several small warnings.
Removed:
celix/trunk/dependency_manager/
celix/trunk/deployment_admin/META-INF/
Modified:
celix/trunk/examples/CMakeLists.txt
celix/trunk/examples/echo_service/client/private/src/echo_client_activator.c
celix/trunk/examples/echo_service/server/private/src/echo_server_activator.c
celix/trunk/examples/hello_world/private/src/activator.c
celix/trunk/examples/hello_world_test/private/src/activator.c
celix/trunk/examples/mongoose/private/src/activator.c
celix/trunk/examples/mongoose/private/src/mongoose.c
celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c
celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c
celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c
celix/trunk/examples/osgi-in-action/chapter04-correct-lookup/private/src/activator.c
celix/trunk/framework/CMakeLists.txt
celix/trunk/framework/private/src/bundle.c
celix/trunk/framework/private/src/bundle_cache.c
celix/trunk/framework/private/src/capability.c
celix/trunk/framework/private/src/filter.c
celix/trunk/framework/private/src/framework.c
celix/trunk/framework/private/src/module.c
celix/trunk/framework/private/src/requirement.c
celix/trunk/framework/private/src/service_registry.c
celix/trunk/framework/private/src/utils.c
celix/trunk/framework/private/src/version_range.c
celix/trunk/framework/private/src/wire.c
celix/trunk/framework/public/include/bundle_activator.h
celix/trunk/launcher/private/src/launcher.c
celix/trunk/remote_services/discovery/private/src/discovery.c
celix/trunk/remote_services/discovery/private/src/discovery_activator.c
celix/trunk/remote_services/discovery/private/src/endpoint_descriptor_reader.c
celix/trunk/remote_services/discovery/private/src/endpoint_descriptor_writer.c
celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c
celix/trunk/remote_services/discovery/private/src/endpoint_discovery_server.c
celix/trunk/remote_services/discovery_configured/private/src/discovery_impl.c
celix/trunk/remote_services/discovery_etcd/private/src/etcd_watcher.c
celix/trunk/remote_services/discovery_shm/private/src/shm_watcher.c
celix/trunk/remote_services/remote_service_admin/private/src/endpoint_description.c
celix/trunk/remote_services/remote_service_admin/private/src/export_registration_impl.c
celix/trunk/remote_services/remote_service_admin/private/src/import_registration_impl.c
celix/trunk/remote_services/remote_service_admin/private/src/remote_proxy_factory_impl.c
celix/trunk/utils/private/src/array_list.c
celix/trunk/utils/private/src/celix_threads.c
celix/trunk/utils/private/src/hash_map.c
celix/trunk/utils/private/src/linked_list.c
celix/trunk/utils/public/include/celix_threads.h
Modified: celix/trunk/examples/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/trunk/examples/CMakeLists.txt?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/examples/CMakeLists.txt (original)
+++ celix/trunk/examples/CMakeLists.txt Wed Mar 18 20:27:29 2015
@@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-celix_subproject(EXAMPLES "Option to enable building the Examples" "OFF" DEPS FRAMEWORK DEPENDENCY_MANAGER2 LAUNCHER SHELL_TUI LOG_WRITER)
+celix_subproject(EXAMPLES "Option to enable building the Examples" "OFF" DEPS FRAMEWORK DEPENDENCY_MANAGER2 LAUNCHER SHELL_TUI LOG_SERVICE LOG_WRITER)
if (EXAMPLES)
add_subdirectory(hello_world)
add_subdirectory(hello_world_test)
Modified: celix/trunk/examples/echo_service/client/private/src/echo_client_activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/examples/echo_service/client/private/src/echo_client_activator.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/examples/echo_service/client/private/src/echo_client_activator.c (original)
+++ celix/trunk/examples/echo_service/client/private/src/echo_client_activator.c Wed Mar 18 20:27:29 2015
@@ -1,4 +1,4 @@
-/**
+#include <sys/cdefs.h>/**
*Licensed to the Apache Software Foundation (ASF) under one
*or more contributor license agreements. See the NOTICE file
*distributed with this work for additional information
@@ -26,7 +26,6 @@
#include <stdlib.h>
#include "bundle_activator.h"
-#include "bundle_context.h"
#include "service_tracker.h"
#include "echo_server.h"
@@ -37,7 +36,7 @@ struct echoActivator {
service_tracker_pt tracker;
};
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+celix_status_t bundleActivator_create(bundle_context_pt __attribute__((unused)) context, void **userData) {
struct echoActivator * act = malloc(sizeof(*act));
act->client = NULL;
act->tracker = NULL;
@@ -65,7 +64,7 @@ celix_status_t bundleActivator_start(voi
return CELIX_SUCCESS;
}
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_stop(void * userData, bundle_context_pt __attribute__((unused)) context) {
struct echoActivator * act = (struct echoActivator *) userData;
serviceTracker_close(act->tracker);
echoClient_stop(act->client);
@@ -73,7 +72,7 @@ celix_status_t bundleActivator_stop(void
return CELIX_SUCCESS;
}
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt __attribute__((unused)) context) {
struct echoActivator * act = (struct echoActivator *) userData;
serviceTracker_destroy(act->tracker);
echoClient_destroy(act->client);
Modified: celix/trunk/examples/echo_service/server/private/src/echo_server_activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/examples/echo_service/server/private/src/echo_server_activator.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/examples/echo_service/server/private/src/echo_server_activator.c (original)
+++ celix/trunk/examples/echo_service/server/private/src/echo_server_activator.c Wed Mar 18 20:27:29 2015
@@ -26,8 +26,6 @@
#include <stdlib.h>
#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "service_registration.h"
#include "echo_server_private.h"
struct echoActivator {
Modified: celix/trunk/examples/hello_world/private/src/activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/examples/hello_world/private/src/activator.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/examples/hello_world/private/src/activator.c (original)
+++ celix/trunk/examples/hello_world/private/src/activator.c Wed Mar 18 20:27:29 2015
@@ -27,7 +27,6 @@
#include <stdio.h>
#include "bundle_activator.h"
-#include "bundle_context.h"
#include "test.h"
@@ -38,7 +37,7 @@ struct userData {
celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
celix_status_t status = CELIX_SUCCESS;
*userData = malloc(sizeof(struct userData));
- if (userData != NULL) {
+ if (*userData != NULL) {
((struct userData *)(*userData))->word = "World";
} else {
status = CELIX_START_ERROR;
Modified: celix/trunk/examples/hello_world_test/private/src/activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/examples/hello_world_test/private/src/activator.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/examples/hello_world_test/private/src/activator.c (original)
+++ celix/trunk/examples/hello_world_test/private/src/activator.c Wed Mar 18 20:27:29 2015
@@ -1,4 +1,4 @@
-/**
+#include <sys/cdefs.h>/**
*Licensed to the Apache Software Foundation (ASF) under one
*or more contributor license agreements. See the NOTICE file
*distributed with this work for additional information
@@ -27,7 +27,6 @@
#include <stdio.h>
#include "bundle_activator.h"
-#include "bundle_context.h"
#include "test.h"
@@ -35,10 +34,10 @@ struct userData {
char * word;
};
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+celix_status_t bundleActivator_create(bundle_context_pt __attribute__((unused)) context, void **userData) {
celix_status_t status = CELIX_SUCCESS;
*userData = malloc(sizeof(struct userData));
- if (userData != NULL) {
+ if (*userData != NULL) {
((struct userData *)(*userData))->word = "Import";
} else {
status = CELIX_START_ERROR;
@@ -46,7 +45,7 @@ celix_status_t bundleActivator_create(bu
return status;
}
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_start(void * userData, bundle_context_pt __attribute__((unused)) context) {
struct userData * data = (struct userData *) userData;
printf("Hello %s\n", data->word);
@@ -55,13 +54,13 @@ celix_status_t bundleActivator_start(voi
return CELIX_SUCCESS;
}
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_stop(void * userData, bundle_context_pt __attribute__((unused)) context) {
struct userData * data = (struct userData *) userData;
printf("Goodbye %s\n", data->word);
return CELIX_SUCCESS;
}
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt __attribute__((unused)) context) {
free(userData);
return CELIX_SUCCESS;
}
Modified: celix/trunk/examples/mongoose/private/src/activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/examples/mongoose/private/src/activator.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/examples/mongoose/private/src/activator.c (original)
+++ celix/trunk/examples/mongoose/private/src/activator.c Wed Mar 18 20:27:29 2015
@@ -1,4 +1,4 @@
-/**
+#include <sys/cdefs.h>/**
*Licensed to the Apache Software Foundation (ASF) under one
*or more contributor license agreements. See the NOTICE file
*distributed with this work for additional information
@@ -27,15 +27,13 @@
#include <stdio.h>
#include "bundle_activator.h"
-#include "bundle_context.h"
#include "mongoose.h"
-#include "bundle.h"
struct userData {
struct mg_context *ctx;
};
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+celix_status_t bundleActivator_create(bundle_context_pt __attribute__((unused)) context, void **userData) {
*userData = calloc(1, sizeof(struct userData));
return CELIX_SUCCESS;
}
@@ -54,7 +52,7 @@ celix_status_t bundleActivator_start(voi
NULL
};
- printf("entry %p\n", entry);
+ printf("entry %s\n", entry);
data->ctx = mg_start(NULL, options);
@@ -68,14 +66,14 @@ celix_status_t bundleActivator_start(voi
return status;
}
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_stop(void * userData, bundle_context_pt __attribute__((unused)) context) {
struct userData * data = (struct userData *) userData;
mg_stop(data->ctx);
printf("Mongoose stopped\n");
return CELIX_SUCCESS;
}
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt __attribute__((unused)) context) {
free(userData);
return CELIX_SUCCESS;
}
Modified: celix/trunk/examples/mongoose/private/src/mongoose.c
URL: http://svn.apache.org/viewvc/celix/trunk/examples/mongoose/private/src/mongoose.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/examples/mongoose/private/src/mongoose.c (original)
+++ celix/trunk/examples/mongoose/private/src/mongoose.c Wed Mar 18 20:27:29 2015
@@ -40,7 +40,6 @@
#include <string.h>
#include <ctype.h>
#include <limits.h>
-#include <stddef.h>
#include <stdio.h>
#if defined(_WIN32) // Windows specific #includes and #defines
@@ -160,14 +159,11 @@ typedef struct DIR {
} DIR;
#else // UNIX specific
-#include <sys/wait.h>
+
#include <sys/socket.h>
#include <sys/select.h>
-#include <sys/mman.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <sys/time.h>
-#include <stdint.h>
#include <inttypes.h>
#include <netdb.h>
Modified: celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c
URL: http://svn.apache.org/viewvc/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c (original)
+++ celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c Wed Mar 18 20:27:29 2015
@@ -1,4 +1,4 @@
-/**
+#include <sys/cdefs.h>/**
*Licensed to the Apache Software Foundation (ASF) under one
*or more contributor license agreements. See the NOTICE file
*distributed with this work for additional information
@@ -27,16 +27,15 @@
#include <stdio.h>
#include "bundle_activator.h"
-#include "bundle_context.h"
#include "greeting_service.h"
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+celix_status_t bundleActivator_create(bundle_context_pt __attribute__((unused)) context, void **userData) {
*userData = NULL;
return CELIX_SUCCESS;
}
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
+celix_status_t bundleActivator_start(void __attribute__((unused)) * userData, bundle_context_pt ctx) {
service_reference_pt ref = NULL;
celix_status_t status = bundleContext_getServiceReference(ctx, (char *) GREETING_SERVICE_NAME, &ref);
if (status == CELIX_SUCCESS) {
@@ -57,10 +56,10 @@ celix_status_t bundleActivator_start(voi
return status;
}
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_stop(void __attribute__((unused)) * userData, bundle_context_pt __attribute__((unused)) context) {
return CELIX_SUCCESS;
}
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_destroy(void __attribute__((unused)) * userData, bundle_context_pt __attribute__((unused)) context) {
return CELIX_SUCCESS;
}
Modified: celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c (original)
+++ celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c Wed Mar 18 20:27:29 2015
@@ -1,4 +1,4 @@
-/**
+#include <sys/cdefs.h>/**
*Licensed to the Apache Software Foundation (ASF) under one
*or more contributor license agreements. See the NOTICE file
*distributed with this work for additional information
@@ -24,13 +24,9 @@
* \copyright Apache License, Version 2.0
*/
#include <stdlib.h>
-#include <stdio.h>
#include "bundle_activator.h"
-#include "bundle_context.h"
#include "greeting_impl.h"
-#include "greeting_service.h"
-#include "service_registration.h"
struct greetingActivator {
service_registration_pt reg;
@@ -39,11 +35,11 @@ struct greetingActivator {
typedef struct greetingActivator *greeting_activator_pt;
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+celix_status_t bundleActivator_create(bundle_context_pt __attribute__((unused)) context, void **userData) {
celix_status_t status = CELIX_SUCCESS;
greeting_activator_pt activator;
*userData = calloc(1, sizeof(struct greetingActivator));
- if (userData) {
+ if (*userData) {
activator = *userData;
activator->reg = NULL;
} else {
@@ -53,7 +49,7 @@ celix_status_t bundleActivator_create(bu
}
celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
greeting_activator_pt act = (greeting_activator_pt) userData;
@@ -75,7 +71,7 @@ celix_status_t bundleActivator_start(voi
return status;
}
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_stop(void * userData, bundle_context_pt __attribute__((unused)) context) {
celix_status_t status = CELIX_SUCCESS;
greeting_activator_pt act = (greeting_activator_pt) userData;
@@ -89,7 +85,7 @@ celix_status_t bundleActivator_stop(void
return status;
}
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt __attribute__((unused)) context) {
free(userData);
return CELIX_SUCCESS;
}
Modified: celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c
URL: http://svn.apache.org/viewvc/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c (original)
+++ celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c Wed Mar 18 20:27:29 2015
@@ -57,7 +57,7 @@ celix_status_t bundleActivator_create(bu
celix_status_t status = CELIX_SUCCESS;
*userData = calloc(1, sizeof(struct listenerActivator));
- if (!userData) {
+ if (!*userData) {
status = CELIX_ENOMEM;
} else {
struct listenerActivator *activator = (*userData);
Modified: celix/trunk/examples/osgi-in-action/chapter04-correct-lookup/private/src/activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/examples/osgi-in-action/chapter04-correct-lookup/private/src/activator.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/examples/osgi-in-action/chapter04-correct-lookup/private/src/activator.c (original)
+++ celix/trunk/examples/osgi-in-action/chapter04-correct-lookup/private/src/activator.c Wed Mar 18 20:27:29 2015
@@ -28,9 +28,7 @@
#include <unistd.h>
#include "bundle_activator.h"
-#include "bundle_context.h"
#include "log_service.h"
-#include "bundle.h"
typedef log_service_pt LOG_SERVICE;
Modified: celix/trunk/framework/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/trunk/framework/CMakeLists.txt?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/framework/CMakeLists.txt (original)
+++ celix/trunk/framework/CMakeLists.txt Wed Mar 18 20:27:29 2015
@@ -62,7 +62,7 @@ if (FRAMEWORK)
public/include/framework.h public/include/properties.h public/include/bundle_context.h public/include/bundle.h
public/include/bundle_activator.h public/include/service_registration.h public/include/service_reference.h
public/include/bundle_archive.h public/include/utils.h public/include/module.h public/include/service_tracker.h
- public/include/service_tracker_customizer.h
+ public/include/service_tracker_customizer.h public/include/requirement.h
${IO}
Modified: celix/trunk/framework/private/src/bundle.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/bundle.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/framework/private/src/bundle.c (original)
+++ celix/trunk/framework/private/src/bundle.c Wed Mar 18 20:27:29 2015
@@ -28,21 +28,14 @@
#include "framework_private.h"
#include "bundle_private.h"
-#include "manifest.h"
-#include "module.h"
-#include "version.h"
-#include "array_list.h"
-#include "bundle_archive.h"
-#include "bundle_revision.h"
#include "resolver.h"
#include "utils.h"
-#include "celix_log.h"
celix_status_t bundle_createModule(bundle_pt bundle, module_pt *module);
celix_status_t bundle_closeRevisions(bundle_pt bundle);
celix_status_t bundle_create(bundle_pt * bundle, framework_logger_pt logger) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
bundle_archive_pt archive = NULL;
*bundle = (bundle_pt) malloc(sizeof(**bundle));
@@ -83,7 +76,7 @@ celix_status_t bundle_create(bundle_pt *
celix_status_t bundle_createFromArchive(bundle_pt * bundle, framework_pt framework, bundle_archive_pt archive) {
module_pt module;
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
*bundle = (bundle_pt) malloc(sizeof(**bundle));
if (*bundle == NULL) {
@@ -360,7 +353,7 @@ celix_status_t bundle_uninstall(bundle_p
}
celix_status_t bundle_setPersistentStateInactive(bundle_pt bundle) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
bool systemBundle;
status = bundle_isSystemBundle(bundle, &systemBundle);
@@ -376,7 +369,7 @@ celix_status_t bundle_setPersistentState
}
celix_status_t bundle_setPersistentStateUninstalled(bundle_pt bundle) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
bool systemBundle;
status = bundle_isSystemBundle(bundle, &systemBundle);
@@ -392,7 +385,7 @@ celix_status_t bundle_setPersistentState
}
celix_status_t bundle_revise(bundle_pt bundle, char * location, char *inputFile) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
bundle_archive_pt archive = NULL;
status = bundle_getArchive(bundle, &archive);
@@ -430,7 +423,7 @@ celix_status_t bundle_addModule(bundle_p
}
celix_status_t bundle_isSystemBundle(bundle_pt bundle, bool *systemBundle) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
long bundleId;
bundle_archive_pt archive = NULL;
@@ -448,7 +441,7 @@ celix_status_t bundle_isSystemBundle(bun
}
celix_status_t bundle_isLockable(bundle_pt bundle, bool *lockable) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
status = celixThreadMutex_lock(&bundle->lock);
if (status != 0) {
@@ -472,7 +465,7 @@ celix_status_t bundle_isLockable(bundle_
}
celix_status_t bundle_getLockingThread(bundle_pt bundle, celix_thread_t *thread) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
status = celixThreadMutex_lock(&bundle->lock);
if (status != 0) {
@@ -492,7 +485,7 @@ celix_status_t bundle_getLockingThread(b
}
celix_status_t bundle_lock(bundle_pt bundle, bool *locked) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
bool equals;
celixThreadMutex_lock(&bundle->lock);
@@ -548,7 +541,7 @@ celix_status_t bundle_unlock(bundle_pt b
celix_status_t bundle_close(bundle_pt bundle) {
bundle_archive_pt archive = NULL;
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
bundle_closeModules(bundle);
bundle_closeRevisions(bundle);
@@ -563,7 +556,7 @@ celix_status_t bundle_close(bundle_pt bu
}
celix_status_t bundle_closeAndDelete(bundle_pt bundle) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
bundle_archive_pt archive = NULL;
@@ -600,7 +593,7 @@ celix_status_t bundle_closeModules(bundl
}
celix_status_t bundle_refresh(bundle_pt bundle) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
module_pt module;
status = bundle_closeModules(bundle);
@@ -621,7 +614,7 @@ celix_status_t bundle_refresh(bundle_pt
}
celix_status_t bundle_getBundleId(bundle_pt bundle, long *id) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
bundle_archive_pt archive = NULL;
status = bundle_getArchive(bundle, &archive);
if (status == CELIX_SUCCESS) {
@@ -634,7 +627,7 @@ celix_status_t bundle_getBundleId(bundle
}
celix_status_t bundle_getRegisteredServices(bundle_pt bundle, array_list_pt *list) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
status = fw_getBundleRegisteredServices(bundle->framework, bundle, list);
@@ -644,7 +637,7 @@ celix_status_t bundle_getRegisteredServi
}
celix_status_t bundle_getServicesInUse(bundle_pt bundle, array_list_pt *list) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
status = fw_getBundleServicesInUse(bundle->framework, bundle, list);
Modified: celix/trunk/framework/private/src/bundle_cache.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/bundle_cache.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/framework/private/src/bundle_cache.c (original)
+++ celix/trunk/framework/private/src/bundle_cache.c Wed Mar 18 20:27:29 2015
@@ -79,7 +79,7 @@ celix_status_t bundleCache_delete(bundle
}
celix_status_t bundleCache_getArchives(bundle_cache_pt cache, array_list_pt *archives) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
DIR *dir;
dir = opendir(cache->cacheDir);
Modified: celix/trunk/framework/private/src/capability.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/capability.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/framework/private/src/capability.c (original)
+++ celix/trunk/framework/private/src/capability.c Wed Mar 18 20:27:29 2015
@@ -30,7 +30,7 @@
#include "celix_log.h"
celix_status_t capability_create(module_pt module, hash_map_pt directives, hash_map_pt attributes, capability_pt *capability) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
*capability = (capability_pt) malloc(sizeof(**capability));
if (!*capability) {
status = CELIX_ENOMEM;
Modified: celix/trunk/framework/private/src/filter.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/filter.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/framework/private/src/filter.c (original)
+++ celix/trunk/framework/private/src/filter.c Wed Mar 18 20:27:29 2015
@@ -30,7 +30,6 @@
#include "celix_log.h"
#include "filter_private.h"
-#include "array_list.h"
void filter_skipWhiteSpace(char * filterString, int * pos);
filter_pt filter_parseFilter(char * filterString, int * pos);
@@ -73,7 +72,7 @@ void filter_destroy(filter_pt filter) {
filter->value = NULL;
} else if ( (filter->operand == OR) || (filter->operand == AND) ) {
int size = arrayList_size(filter->value);
- int i = 0;
+ unsigned int i = 0;
for (i = 0; i < size; i++) {
filter_pt f = arrayList_get(filter->value, i);
filter_destroy(f);
@@ -459,7 +458,7 @@ celix_status_t filter_match(filter_pt fi
case APPROX : {
char * value = (properties == NULL) ? NULL: properties_get(properties, filter->attribute);
- return filter_compare(filter->operand, (char *) value, filter->value, result);
+ return filter_compare(filter->operand, value, filter->value, result);
}
case PRESENT: {
char * value = (properties == NULL) ? NULL: properties_get(properties, filter->attribute);
@@ -485,7 +484,7 @@ celix_status_t filter_compareString(OPER
case SUBSTRING: {
array_list_pt subs = (array_list_pt) value2;
int pos = 0;
- int i;
+ unsigned int i;
int size = arrayList_size(subs);
for (i = 0; i < size; i++) {
char * substr = (char *) arrayList_get(subs, i);
Modified: celix/trunk/framework/private/src/framework.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/framework.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/framework/private/src/framework.c (original)
+++ celix/trunk/framework/private/src/framework.c Wed Mar 18 20:27:29 2015
@@ -334,10 +334,10 @@ celix_status_t framework_destroy(framewo
celix_status_t fw_init(framework_pt framework) {
bundle_state_e state;
- char *location;
+ char *location = NULL;
module_pt module = NULL;
- linked_list_pt wires;
- array_list_pt archives;
+ linked_list_pt wires = NULL;
+ array_list_pt archives = NULL;
bundle_archive_pt archive = NULL;
char uuid[37];
@@ -478,7 +478,7 @@ celix_status_t fw_init(framework_pt fram
celix_status_t framework_start(framework_pt framework) {
celix_status_t status = CELIX_SUCCESS;
- bundle_state_e state;
+ bundle_state_e state = OSGI_FRAMEWORK_BUNDLE_UNKNOWN;
status = CELIX_DO_IF(status, framework_acquireBundleLock(framework, framework->bundle, OSGI_FRAMEWORK_BUNDLE_INSTALLED|OSGI_FRAMEWORK_BUNDLE_RESOLVED|OSGI_FRAMEWORK_BUNDLE_STARTING|OSGI_FRAMEWORK_BUNDLE_ACTIVE));
status = CELIX_DO_IF(status, bundle_getState(framework->bundle, &state));
@@ -538,7 +538,7 @@ celix_status_t fw_installBundle(framewor
celix_status_t fw_installBundle2(framework_pt framework, bundle_pt * bundle, long id, char * location, char *inputFile, bundle_archive_pt archive) {
celix_status_t status = CELIX_SUCCESS;
// bundle_archive_pt bundle_archive = NULL;
- bundle_state_e state;
+ bundle_state_e state = OSGI_FRAMEWORK_BUNDLE_UNKNOWN;
bool locked;
status = CELIX_DO_IF(status, framework_acquireInstallLock(framework, location));
@@ -943,8 +943,8 @@ celix_status_t fw_uninstallBundle(framew
celix_status_t status = CELIX_SUCCESS;
bool locked;
bundle_archive_pt archive = NULL;
- char * location;
- bundle_pt target;
+ char * location = NULL;
+ bundle_pt target = NULL;
char *error = NULL;
status = CELIX_DO_IF(status, framework_acquireBundleLock(framework, bundle, OSGI_FRAMEWORK_BUNDLE_INSTALLED|OSGI_FRAMEWORK_BUNDLE_RESOLVED|OSGI_FRAMEWORK_BUNDLE_STARTING|OSGI_FRAMEWORK_BUNDLE_ACTIVE|OSGI_FRAMEWORK_BUNDLE_STOPPING));
@@ -1233,7 +1233,7 @@ celix_status_t fw_registerService(framew
unsigned int i;
array_list_pt infos = NULL;
service_reference_pt ref = NULL;
- listener_hook_service_pt hook;
+ listener_hook_service_pt hook = NULL;
status = CELIX_DO_IF(status, arrayList_create(&infos));
Modified: celix/trunk/framework/private/src/module.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/module.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/framework/private/src/module.c (original)
+++ celix/trunk/framework/private/src/module.c Wed Mar 18 20:27:29 2015
@@ -30,10 +30,6 @@
#include "module.h"
#include "manifest_parser.h"
#include "linked_list_iterator.h"
-#include "capability.h"
-#include "requirement.h"
-#include "wire.h"
-#include "bundle.h"
struct module {
linked_list_pt capabilities;
Modified: celix/trunk/framework/private/src/requirement.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/requirement.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/framework/private/src/requirement.c (original)
+++ celix/trunk/framework/private/src/requirement.c Wed Mar 18 20:27:29 2015
@@ -31,7 +31,7 @@
#include "celix_log.h"
celix_status_t requirement_create(hash_map_pt directives, hash_map_pt attributes, requirement_pt *requirement) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
*requirement = (requirement_pt) malloc(sizeof(**requirement));
if (!*requirement) {
@@ -98,7 +98,7 @@ celix_status_t requirement_getTargetName
}
celix_status_t requirement_isSatisfied(requirement_pt requirement, capability_pt capability, bool *inRange) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
version_pt version = NULL;
version_range_pt range = NULL;
Modified: celix/trunk/framework/private/src/service_registry.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/service_registry.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/framework/private/src/service_registry.c (original)
+++ celix/trunk/framework/private/src/service_registry.c Wed Mar 18 20:27:29 2015
@@ -520,13 +520,15 @@ celix_status_t serviceRegistry_ungetServ
service_registration_pt registration = NULL;
usage_count_pt usage = NULL;
serviceReference_getServiceRegistration(reference, ®istration);
-
+
celixThreadMutex_lock(®istry->mutex);
status = serviceRegistry_getUsageCount(registry, bundle, reference, &usage);
if (usage == NULL) {
celixThreadMutex_unlock(®istry->mutex);
- *result = false;
+ if (result) {
+ *result = false;
+ }
return CELIX_SUCCESS;
}
@@ -543,7 +545,9 @@ celix_status_t serviceRegistry_ungetServ
celixThreadMutex_unlock(®istry->mutex);
- *result = true;
+ if (result) {
+ *result = true;
+ }
return status;
}
Modified: celix/trunk/framework/private/src/utils.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/utils.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/framework/private/src/utils.c (original)
+++ celix/trunk/framework/private/src/utils.c Wed Mar 18 20:27:29 2015
@@ -27,8 +27,6 @@
#include <string.h>
#include "utils.h"
-#include "celix_log.h"
-#include "celix_threads.h"
unsigned int utils_stringHash(void * string) {
char * str = (char *) string;
Modified: celix/trunk/framework/private/src/version_range.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/version_range.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/framework/private/src/version_range.c (original)
+++ celix/trunk/framework/private/src/version_range.c Wed Mar 18 20:27:29 2015
@@ -67,7 +67,7 @@ celix_status_t versionRange_destroy(vers
}
celix_status_t versionRange_createInfiniteVersionRange(version_range_pt *range) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
version_pt version = NULL;
status = version_createEmptyVersion(&version);
@@ -81,7 +81,7 @@ celix_status_t versionRange_createInfini
}
celix_status_t versionRange_isInRange(version_range_pt versionRange, version_pt version, bool *inRange) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
if (versionRange->high == NULL) {
int cmp;
status = version_compareTo(version, versionRange->low, &cmp);
@@ -132,7 +132,7 @@ celix_status_t versionRange_isInRange(ve
}
celix_status_t versionRange_parse(char * rangeStr, version_range_pt *range) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
if (strchr(rangeStr, ',') != NULL) {
int vlowL = strcspn(rangeStr+1, ",");
char * vlow = (char *) malloc(sizeof(*vlow * (vlowL + 1)));
Modified: celix/trunk/framework/private/src/wire.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/wire.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/framework/private/src/wire.c (original)
+++ celix/trunk/framework/private/src/wire.c Wed Mar 18 20:27:29 2015
@@ -24,10 +24,8 @@
* \copyright Apache License, Version 2.0
*/
#include <stdlib.h>
-#include <string.h>
#include "wire.h"
-#include "celix_log.h"
struct wire {
module_pt importer;
Modified: celix/trunk/framework/public/include/bundle_activator.h
URL: http://svn.apache.org/viewvc/celix/trunk/framework/public/include/bundle_activator.h?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/framework/public/include/bundle_activator.h (original)
+++ celix/trunk/framework/public/include/bundle_activator.h Wed Mar 18 20:27:29 2015
@@ -54,7 +54,7 @@
* - Any other status code will mark the bundle as stopped and the framework will remove this
* bundle's listeners, unregister all services, and release all services used by this bundle.
*/
-ACTIVATOR_EXPORT celix_status_t bundleActivator_create(bundle_context_pt context, void **userData);
+ACTIVATOR_EXPORT celix_status_t bundleActivator_create(bundle_context_pt context_ptr, void **userData);
/**
* Called when this bundle is started so the Framework can perform the bundle-specific activities necessary
@@ -72,7 +72,7 @@ ACTIVATOR_EXPORT celix_status_t bundleAc
* - Any other status code will mark the bundle as stopped and the framework will remove this
* bundle's listeners, unregister all services, and release all services used by this bundle.
*/
-ACTIVATOR_EXPORT celix_status_t bundleActivator_start(void * userData, bundle_context_pt context);
+ACTIVATOR_EXPORT celix_status_t bundleActivator_start(void *userData, bundle_context_pt context);
/**
* Called when this bundle is stopped so the Framework can perform the bundle-specific activities necessary
@@ -91,7 +91,7 @@ ACTIVATOR_EXPORT celix_status_t bundleAc
* - Any other status code will mark the bundle as stopped and the framework will remove this
* bundle's listeners, unregister all services, and release all services used by this bundle.
*/
-ACTIVATOR_EXPORT celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context);
+ACTIVATOR_EXPORT celix_status_t bundleActivator_stop(void *userData, bundle_context_pt context);
/**
* Called when this bundle is stopped so the bundle can destroy the instance of its activator. In general, this
@@ -108,7 +108,7 @@ ACTIVATOR_EXPORT celix_status_t bundleAc
* - Any other status code will mark the bundle as stopped and the framework will remove this
* bundle's listeners, unregister all services, and release all services used by this bundle.
*/
-ACTIVATOR_EXPORT celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context);
+ACTIVATOR_EXPORT celix_status_t bundleActivator_destroy(void *userData, bundle_context_pt __attribute__((unused)) __attribute__((unused)) context);
#endif /* BUNDLE_ACTIVATOR_H_ */
Modified: celix/trunk/launcher/private/src/launcher.c
URL: http://svn.apache.org/viewvc/celix/trunk/launcher/private/src/launcher.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/launcher/private/src/launcher.c (original)
+++ celix/trunk/launcher/private/src/launcher.c Wed Mar 18 20:27:29 2015
@@ -26,18 +26,13 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <signal.h>
#include <libgen.h>
#include <apr_general.h>
#include <apr_strings.h>
#include <curl/curl.h>
#include "framework.h"
-#include "properties.h"
-#include "bundle_context.h"
-#include "bundle.h"
#include "linked_list_iterator.h"
-#include "celix_log.h"
#define DEFAULT_CONFIG_FILE "config.properties"
Modified: celix/trunk/remote_services/discovery/private/src/discovery.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery/private/src/discovery.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery/private/src/discovery.c (original)
+++ celix/trunk/remote_services/discovery/private/src/discovery.c Wed Mar 18 20:27:29 2015
@@ -24,32 +24,18 @@
* \copyright Apache License, Version 2.0
*/
#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
#include <stdbool.h>
#include <netdb.h>
-#include <netinet/in.h>
-#include "constants.h"
#include "celix_threads.h"
#include "bundle_context.h"
-#include "array_list.h"
-#include "utils.h"
-#include "celix_errno.h"
-#include "filter.h"
-#include "service_reference.h"
-#include "service_registration.h"
-#include "remote_constants.h"
#include "log_helper.h"
-#include "log_service.h"
#include "discovery.h"
#include "discovery_impl.h"
-#include "endpoint_discovery_poller.h"
-#include "endpoint_discovery_server.h"
celix_status_t discovery_endpointAdded(void *handle, endpoint_description_pt endpoint, char *matchedFilter) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
discovery_pt discovery = handle;
logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "Endpoint for %s, with filter \"%s\" added...", endpoint->service, matchedFilter);
@@ -60,7 +46,7 @@ celix_status_t discovery_endpointAdded(v
}
celix_status_t discovery_endpointRemoved(void *handle, endpoint_description_pt endpoint, char *matchedFilter) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
discovery_pt discovery = handle;
logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "Endpoint for %s, with filter \"%s\" removed...", endpoint->service, matchedFilter);
@@ -126,109 +112,121 @@ celix_status_t discovery_endpointListene
}
celix_status_t discovery_endpointListenerModified(void * handle, service_reference_pt reference, void * service) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
status = discovery_endpointListenerRemoved(handle, reference, service);
- status = discovery_endpointListenerAdded(handle, reference, service);
+ if (status == CELIX_SUCCESS) {
+ status = discovery_endpointListenerAdded(handle, reference, service);
+ }
return status;
}
celix_status_t discovery_endpointListenerRemoved(void * handle, service_reference_pt reference, void * service) {
- celix_status_t status = CELIX_SUCCESS;
- discovery_pt discovery = handle;
+ celix_status_t status;
+ discovery_pt discovery = handle;
- status = celixThreadMutex_lock(&discovery->listenerReferencesMutex);
+ status = celixThreadMutex_lock(&discovery->listenerReferencesMutex);
- if (discovery->listenerReferences != NULL) {
- if (hashMap_remove(discovery->listenerReferences, reference)) {
- logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "EndpointListener Removed");
- }
- }
+ if (status == CELIX_SUCCESS) {
+ if (discovery->listenerReferences != NULL) {
+ if (hashMap_remove(discovery->listenerReferences, reference)) {
+ logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "EndpointListener Removed");
+ }
+ }
- status = celixThreadMutex_unlock(&discovery->listenerReferencesMutex);
+ status = celixThreadMutex_unlock(&discovery->listenerReferencesMutex);
+ }
return status;
}
celix_status_t discovery_informEndpointListeners(discovery_pt discovery, endpoint_description_pt endpoint, bool endpointAdded) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
// Inform listeners of new endpoint
status = celixThreadMutex_lock(&discovery->listenerReferencesMutex);
- if (discovery->listenerReferences != NULL) {
- hash_map_iterator_pt iter = hashMapIterator_create(discovery->listenerReferences);
- while (hashMapIterator_hasNext(iter)) {
- hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
-
- service_reference_pt reference = hashMapEntry_getKey(entry);
- endpoint_listener_pt listener = NULL;
-
- char *scope = NULL;
- serviceReference_getProperty(reference, (char *) OSGI_ENDPOINT_LISTENER_SCOPE, &scope);
-
- filter_pt filter = filter_create(scope);
- bool matchResult = false;
-
- status = filter_match(filter, endpoint->properties, &matchResult);
- if (matchResult) {
- bundleContext_getService(discovery->context, reference, (void**) &listener);
- if (endpointAdded) {
- logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "Adding service (%s)", endpoint->service);
-
- listener->endpointAdded(listener->handle, endpoint, scope);
- } else {
- logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "Removing service (%s)", endpoint->service);
-
- listener->endpointRemoved(listener->handle, endpoint, scope);
- }
- }
-
- filter_destroy(filter);
- }
- hashMapIterator_destroy(iter);
- }
+ if (status == CELIX_SUCCESS) {
+ if (discovery->listenerReferences != NULL) {
+ hash_map_iterator_pt iter = hashMapIterator_create(discovery->listenerReferences);
+ while (hashMapIterator_hasNext(iter)) {
+ hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+
+ service_reference_pt reference = hashMapEntry_getKey(entry);
+ endpoint_listener_pt listener = NULL;
+
+ char *scope = NULL;
+ serviceReference_getProperty(reference, (char *) OSGI_ENDPOINT_LISTENER_SCOPE, &scope);
+
+ filter_pt filter = filter_create(scope);
+ bool matchResult = false;
+
+ status = filter_match(filter, endpoint->properties, &matchResult);
+ if (status == CELIX_SUCCESS) {
+ if (matchResult) {
+ bundleContext_getService(discovery->context, reference, (void **) &listener);
+ if (endpointAdded) {
+ logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "Adding service (%s)", endpoint->service);
+
+ listener->endpointAdded(listener->handle, endpoint, scope);
+ } else {
+ logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_INFO, "Removing service (%s)", endpoint->service);
+
+ listener->endpointRemoved(listener->handle, endpoint, scope);
+ }
+ }
+
+ filter_destroy(filter);
+ }
+ }
+ hashMapIterator_destroy(iter);
+ }
- status = celixThreadMutex_unlock(&discovery->listenerReferencesMutex);
+ status = celixThreadMutex_unlock(&discovery->listenerReferencesMutex);
+ }
return status;
}
celix_status_t discovery_addDiscoveredEndpoint(discovery_pt discovery, endpoint_description_pt endpoint) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
status = celixThreadMutex_lock(&discovery->discoveredServicesMutex);
- char* endpointId = endpoint->id;
- bool exists = hashMap_get(discovery->discoveredServices, endpointId) != NULL;
- if (!exists) {
- hashMap_put(discovery->discoveredServices, endpointId, endpoint);
- }
-
- status = celixThreadMutex_unlock(&discovery->discoveredServicesMutex);
-
- if (!exists) {
- // notify our listeners that a new endpoint is available...
- discovery_informEndpointListeners(discovery, endpoint, true /* addingService */);
- }
+ if (status == CELIX_SUCCESS) {
+ char *endpointId = endpoint->id;
+ bool exists = hashMap_get(discovery->discoveredServices, endpointId) != NULL;
+ if (!exists) {
+ hashMap_put(discovery->discoveredServices, endpointId, endpoint);
+ }
+
+ status = celixThreadMutex_unlock(&discovery->discoveredServicesMutex);
+
+ if (!exists) {
+ // notify our listeners that a new endpoint is available...
+ discovery_informEndpointListeners(discovery, endpoint, true /* addingService */);
+ }
+ }
return status;
}
celix_status_t discovery_removeDiscoveredEndpoint(discovery_pt discovery, endpoint_description_pt endpoint) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
status = celixThreadMutex_lock(&discovery->discoveredServicesMutex);
- char* endpointId = endpoint->id;
- void* oldValue = hashMap_remove(discovery->discoveredServices, endpointId);
-
- status = celixThreadMutex_unlock(&discovery->discoveredServicesMutex);
-
- if (oldValue) {
- status = discovery_informEndpointListeners(discovery, endpoint, false /* addingService */);
- }
+ if (status == CELIX_SUCCESS) {
+ char *endpointId = endpoint->id;
+ void *oldValue = hashMap_remove(discovery->discoveredServices, endpointId);
+
+ status = celixThreadMutex_unlock(&discovery->discoveredServicesMutex);
+
+ if (oldValue) {
+ status = discovery_informEndpointListeners(discovery, endpoint, false /* addingService */);
+ }
+ }
return status;
}
Modified: celix/trunk/remote_services/discovery/private/src/discovery_activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery/private/src/discovery_activator.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery/private/src/discovery_activator.c (original)
+++ celix/trunk/remote_services/discovery/private/src/discovery_activator.c Wed Mar 18 20:27:29 2015
@@ -29,13 +29,10 @@
#include "bundle_activator.h"
#include "service_tracker.h"
-#include "service_registration.h"
#include "constants.h"
#include "log_helper.h"
-#include "log_service.h"
#include "discovery.h"
-#include "endpoint_listener.h"
#include "remote_constants.h"
struct activator {
@@ -49,7 +46,7 @@ struct activator {
};
celix_status_t bundleActivator_createEPLTracker(struct activator *activator, service_tracker_pt *tracker) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
service_tracker_customizer_pt customizer = NULL;
@@ -65,7 +62,7 @@ celix_status_t bundleActivator_createEPL
}
celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
struct activator* activator = malloc(sizeof(struct activator));
if (!activator) {
@@ -92,7 +89,7 @@ celix_status_t bundleActivator_create(bu
}
celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
struct activator *activator = userData;
char *uuid = NULL;
@@ -148,7 +145,7 @@ celix_status_t bundleActivator_start(voi
}
celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
struct activator *activator = userData;
status = discovery_stop(activator->discovery);
@@ -164,13 +161,11 @@ celix_status_t bundleActivator_stop(void
}
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
struct activator *activator = userData;
status = serviceTracker_destroy(activator->endpointListenerTracker);
-// status = serviceRegistration_destroy(activator->endpointListenerService);
-
status = discovery_destroy(activator->discovery);
logHelper_destroy(&activator->loghelper);
Modified: celix/trunk/remote_services/discovery/private/src/endpoint_descriptor_reader.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery/private/src/endpoint_descriptor_reader.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery/private/src/endpoint_descriptor_reader.c (original)
+++ celix/trunk/remote_services/discovery/private/src/endpoint_descriptor_reader.c Wed Mar 18 20:27:29 2015
@@ -29,16 +29,11 @@
#include <libxml/xmlreader.h>
#include "log_helper.h"
-#include "log_service.h"
-#include "constants.h"
#include "remote_constants.h"
#include "endpoint_description.h"
#include "endpoint_descriptor_common.h"
#include "endpoint_descriptor_reader.h"
-#include "endpoint_discovery_poller.h"
-#include "properties.h"
-#include "utils.h"
struct endpoint_descriptor_reader {
xmlTextReaderPtr reader;
@@ -51,7 +46,7 @@ celix_status_t endpointDescriptorReader_
celix_status_t status = CELIX_SUCCESS;
*reader = malloc(sizeof(**reader));
- if (!reader) {
+ if (!*reader) {
status = CELIX_ENOMEM;
} else {
(*reader)->reader = NULL;
@@ -78,8 +73,9 @@ void endpointDescriptorReader_addSingleV
void endpointDescriptorReader_addMultiValuedProperty(properties_pt properties, const xmlChar* name, array_list_pt values) {
char *value = calloc(256, sizeof(*value));
if (value) {
- int i, size = arrayList_size(values);
- for (i = 0; i < size; i++) {
+ unsigned int size = arrayList_size(values);
+ unsigned int i;
+ for (i = 0; i < size; i++) {
char* item = (char*) arrayList_get(values, i);
if (i > 0) {
value = strcat(value, ",");
@@ -96,8 +92,8 @@ void endpointDescriptorReader_addMultiVa
celix_status_t endpointDescriptorReader_parseDocument(endpoint_descriptor_reader_pt reader, char *document, array_list_pt *endpoints) {
celix_status_t status = CELIX_SUCCESS;
- reader->reader = xmlReaderForMemory(document, strlen(document), NULL, "UTF-8", 0);
- if (reader == NULL) {
+ reader->reader = xmlReaderForMemory(document, (int) strlen(document), NULL, "UTF-8", 0);
+ if (reader->reader == NULL) {
status = CELIX_BUNDLE_EXCEPTION;
} else {
bool inProperty = false;
@@ -165,8 +161,8 @@ celix_status_t endpointDescriptorReader_
propertyName = xmlTextReaderGetAttribute(reader->reader, NAME);
propertyValue = xmlTextReaderGetAttribute(reader->reader, VALUE);
- xmlChar* type = xmlTextReaderGetAttribute(reader->reader, VALUE_TYPE);
- propertyType = valueTypeFromString((char*) type);
+ xmlChar *vtype = xmlTextReaderGetAttribute(reader->reader, VALUE_TYPE);
+ propertyType = valueTypeFromString((char*) vtype);
arrayList_clear(propertyValues);
if (xmlTextReaderIsEmptyElement(reader->reader)) {
@@ -182,7 +178,7 @@ celix_status_t endpointDescriptorReader_
xmlFree((void *) propertyName);
xmlFree((void *) propertyValue);
- xmlFree((void *) type);
+ xmlFree((void *) vtype);
}
} else {
valueBuffer[0] = 0;
@@ -230,7 +226,7 @@ celix_status_t endpointDescriptorReader_
}
xmlFree((void *) propertyName);
- int k=0;
+ unsigned int k=0;
for(;k<arrayList_size(propertyValues);k++){
free(arrayList_get(propertyValues,k));
}
@@ -261,7 +257,7 @@ celix_status_t endpointDescriptorReader_
properties_destroy(endpointProperties);
}
- int k=0;
+ unsigned int k=0;
for(;k<arrayList_size(propertyValues);k++){
free(arrayList_get(propertyValues,k));
}
Modified: celix/trunk/remote_services/discovery/private/src/endpoint_descriptor_writer.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery/private/src/endpoint_descriptor_writer.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery/private/src/endpoint_descriptor_writer.c (original)
+++ celix/trunk/remote_services/discovery/private/src/endpoint_descriptor_writer.c Wed Mar 18 20:27:29 2015
@@ -24,7 +24,6 @@
* \copyright Apache License, Version 2.0
*/
#include <stdlib.h>
-#include <stdio.h>
#include <string.h>
#include <libxml/xmlwriter.h>
@@ -48,7 +47,7 @@ celix_status_t endpointDescriptorWriter_
celix_status_t status = CELIX_SUCCESS;
*writer = malloc(sizeof(**writer));
- if (!writer) {
+ if (!*writer) {
status = CELIX_ENOMEM;
} else {
(*writer)->buffer = xmlBufferCreate();
@@ -84,7 +83,7 @@ celix_status_t endpointDescriptorWriter_
if (rc < 0) {
status = CELIX_BUNDLE_EXCEPTION;
} else {
- int i;
+ unsigned int i;
for (i = 0; i < arrayList_size(endpoints); i++) {
endpoint_description_pt endpoint = arrayList_get(endpoints, i);
status = endpointDescriptorWriter_writeEndpoint(writer, endpoint);
Modified: celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c (original)
+++ celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c Wed Mar 18 20:27:29 2015
@@ -32,16 +32,11 @@
#include <curl/curl.h>
#include "bundle_context.h"
-#include "hash_map.h"
-#include "array_list.h"
#include "log_helper.h"
-#include "celix_threads.h"
#include "utils.h"
#include "discovery_impl.h"
-#include "endpoint_listener.h"
-#include "endpoint_discovery_poller.h"
#include "endpoint_descriptor_reader.h"
@@ -56,10 +51,10 @@ static celix_status_t endpointDiscoveryP
* Allocates memory and initializes a new endpoint_discovery_poller instance.
*/
celix_status_t endpointDiscoveryPoller_create(discovery_pt discovery, bundle_context_pt context, endpoint_discovery_poller_pt *poller) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
*poller = malloc(sizeof(struct endpoint_discovery_poller));
- if (!poller) {
+ if (!*poller) {
return CELIX_ENOMEM;
}
@@ -120,7 +115,7 @@ celix_status_t endpointDiscoveryPoller_c
* Destroys and frees up memory for a given endpoint_discovery_poller struct.
*/
celix_status_t endpointDiscoveryPoller_destroy(endpoint_discovery_poller_pt poller) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
poller->running = false;
@@ -177,7 +172,7 @@ celix_status_t endpointDiscoveryPoller_g
* Adds a new endpoint URL to the list of polled endpoints.
*/
celix_status_t endpointDiscoveryPoller_addDiscoveryEndpoint(endpoint_discovery_poller_pt poller, char *url) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
status = celixThreadMutex_lock(&(poller)->pollerLock);
if (status != CELIX_SUCCESS) {
@@ -203,7 +198,7 @@ celix_status_t endpointDiscoveryPoller_a
* Removes an endpoint URL from the list of polled endpoints.
*/
celix_status_t endpointDiscoveryPoller_removeDiscoveryEndpoint(endpoint_discovery_poller_pt poller, char *url) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
status = celixThreadMutex_lock(&poller->pollerLock);
if (status != CELIX_SUCCESS) {
@@ -215,7 +210,7 @@ celix_status_t endpointDiscoveryPoller_r
array_list_pt entries = hashMap_remove(poller->entries, url);
- for (int i = arrayList_size(entries); i > 0 ; i--) {
+ for (unsigned int i = arrayList_size(entries); i > 0 ; i--) {
endpoint_description_pt endpoint = arrayList_get(entries, i-1);
discovery_removeDiscoveredEndpoint(poller->discovery, endpoint);
arrayList_remove(entries, i-1);
@@ -236,7 +231,7 @@ celix_status_t endpointDiscoveryPoller_r
static void *endpointDiscoveryPoller_poll(void *data) {
endpoint_discovery_poller_pt poller = (endpoint_discovery_poller_pt) data;
- useconds_t interval = poller->poll_interval * 1000000L;
+ useconds_t interval = (useconds_t) (poller->poll_interval * 1000000L);
while (poller->running) {
usleep(interval);
@@ -265,7 +260,7 @@ static void *endpointDiscoveryPoller_pol
}
if (updatedEndpoints) {
- for (int i = arrayList_size(currentEndpoints); i > 0 ; i--) {
+ for (unsigned int i = arrayList_size(currentEndpoints); i > 0 ; i--) {
endpoint_description_pt endpoint = arrayList_get(currentEndpoints, i-1);
if (!arrayList_contains(updatedEndpoints, endpoint)) {
status = discovery_removeDiscoveredEndpoint(poller->discovery, endpoint);
@@ -331,7 +326,7 @@ static celix_status_t endpointDiscoveryP
celix_status_t status = CELIX_SUCCESS;
CURL *curl = NULL;
- CURLcode res = 0;
+ CURLcode res = CURLE_OK;
struct MemoryStruct chunk;
chunk.memory = malloc(1);
Modified: celix/trunk/remote_services/discovery/private/src/endpoint_discovery_server.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery/private/src/endpoint_discovery_server.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery/private/src/endpoint_discovery_server.c (original)
+++ celix/trunk/remote_services/discovery/private/src/endpoint_discovery_server.c Wed Mar 18 20:27:29 2015
@@ -24,21 +24,17 @@
* \copyright Apache License, Version 2.0
*/
#include <stdlib.h>
-#include <stdint.h>
#include <arpa/inet.h>
-#include <sys/socket.h>
#include <netdb.h>
#include <ifaddrs.h>
#include "civetweb.h"
#include "celix_errno.h"
#include "utils.h"
#include "log_helper.h"
-#include "log_service.h"
#include "discovery.h"
#include "discovery_impl.h"
#include "endpoint_descriptor_writer.h"
-#include "endpoint_discovery_server.h"
// defines how often the webserver is restarted (with an increased port number)
#define MAX_NUMBER_OF_RESTARTS 5
@@ -71,7 +67,7 @@ static char* format_path(char* path);
static celix_status_t endpointDiscoveryServer_getIpAdress(char* interface, char** ip);
celix_status_t endpointDiscoveryServer_create(discovery_pt discovery, bundle_context_pt context, endpoint_discovery_server_pt *server) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
char *port = 0;
char *ip = NULL;
@@ -159,14 +155,14 @@ celix_status_t endpointDiscoveryServer_c
else {
errno = 0;
char* endptr = port;
- int currentPort = strtol(port, &endptr, 10);
+ long currentPort = strtol(port, &endptr, 10);
if (*endptr || errno != 0) {
currentPort = strtol(DEFAULT_SERVER_PORT, NULL, 10);
}
port_counter++;
- snprintf(&newPort[0], 10, "%d", (currentPort+1));
+ snprintf(&newPort[0], 10, "%ld", (currentPort+1));
logHelper_log(discovery->loghelper, OSGI_LOGSERVICE_ERROR, "Error while starting discovery server on port %s - retrying on port %s...", port, newPort);
port = newPort;
@@ -193,7 +189,7 @@ celix_status_t endpointDiscoveryServer_g
}
celix_status_t endpointDiscoveryServer_destroy(endpoint_discovery_server_pt server) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
// stop & block until the actual server is shut down...
if (server->ctx != NULL) {
@@ -218,7 +214,7 @@ celix_status_t endpointDiscoveryServer_d
}
celix_status_t endpointDiscoveryServer_addEndpoint(endpoint_discovery_server_pt server, endpoint_description_pt endpoint) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
status = celixThreadMutex_lock(&server->serverLock);
if (status != CELIX_SUCCESS) {
@@ -243,7 +239,7 @@ celix_status_t endpointDiscoveryServer_a
}
celix_status_t endpointDiscoveryServer_removeEndpoint(endpoint_discovery_server_pt server, endpoint_description_pt endpoint) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
status = celixThreadMutex_lock(&server->serverLock);
if (status != CELIX_SUCCESS) {
@@ -284,7 +280,7 @@ static char* format_path(char* path) {
}
static celix_status_t endpointDiscoveryServer_getEndpoints(endpoint_discovery_server_pt server, const char* the_endpoint_id, array_list_pt *endpoints) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
status = arrayList_create(endpoints);
if (status != CELIX_SUCCESS) {
@@ -318,7 +314,7 @@ static celix_status_t endpointDiscoveryS
}
static int endpointDiscoveryServer_writeEndpoints(struct mg_connection* conn, array_list_pt endpoints) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
endpoint_descriptor_writer_pt writer = NULL;
status = endpointDescriptorWriter_create(&writer);
Modified: celix/trunk/remote_services/discovery_configured/private/src/discovery_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_configured/private/src/discovery_impl.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_configured/private/src/discovery_impl.c (original)
+++ celix/trunk/remote_services/discovery_configured/private/src/discovery_impl.c Wed Mar 18 20:27:29 2015
@@ -25,32 +25,20 @@
*/
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
#include <stdbool.h>
#include <netdb.h>
-#include <netinet/in.h>
-#include "constants.h"
#include "celix_threads.h"
#include "bundle_context.h"
-#include "array_list.h"
#include "utils.h"
-#include "celix_errno.h"
-#include "filter.h"
-#include "service_reference.h"
-#include "service_registration.h"
-#include "remote_constants.h"
#include "log_helper.h"
#include "discovery.h"
#include "discovery_impl.h"
-#include "endpoint_discovery_poller.h"
-#include "endpoint_discovery_server.h"
-
celix_status_t discovery_create(bundle_context_pt context, discovery_pt *discovery) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
*discovery = malloc(sizeof(struct discovery));
if (!*discovery) {
@@ -74,7 +62,7 @@ celix_status_t discovery_create(bundle_c
}
celix_status_t discovery_start(discovery_pt discovery) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
logHelper_start(discovery->loghelper);
Modified: celix/trunk/remote_services/discovery_etcd/private/src/etcd_watcher.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_etcd/private/src/etcd_watcher.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_etcd/private/src/etcd_watcher.c (original)
+++ celix/trunk/remote_services/discovery_etcd/private/src/etcd_watcher.c Wed Mar 18 20:27:29 2015
@@ -264,7 +264,7 @@ celix_status_t etcdWatcher_create(discov
(*watcher) = calloc(1, sizeof(struct etcd_watcher));
- if (!watcher) {
+ if (!*watcher) {
return CELIX_ENOMEM;
}
else
Modified: celix/trunk/remote_services/discovery_shm/private/src/shm_watcher.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_shm/private/src/shm_watcher.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_shm/private/src/shm_watcher.c (original)
+++ celix/trunk/remote_services/discovery_shm/private/src/shm_watcher.c Wed Mar 18 20:27:29 2015
@@ -173,7 +173,7 @@ celix_status_t shmWatcher_create(endpoin
}
(*watcher) = calloc(1, sizeof(struct shm_watcher));
- if (!watcher) {
+ if (!*watcher) {
return CELIX_ENOMEM;
} else {
(*watcher)->poller = poller;
Modified: celix/trunk/remote_services/remote_service_admin/private/src/endpoint_description.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin/private/src/endpoint_description.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin/private/src/endpoint_description.c (original)
+++ celix/trunk/remote_services/remote_service_admin/private/src/endpoint_description.c Wed Mar 18 20:27:29 2015
@@ -24,7 +24,6 @@
* \copyright Apache License, Version 2.0
*/
#include <stdlib.h>
-#include <stdio.h>
#include "celix_errno.h"
#include "celix_log.h"
@@ -36,7 +35,7 @@
static celix_status_t endpointDescription_verifyLongProperty(properties_pt properties, char *propertyName, long *longProperty);
celix_status_t endpointDescription_create(properties_pt properties, endpoint_description_pt *endpointDescription) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
*endpointDescription = malloc(sizeof(**endpointDescription));
Modified: celix/trunk/remote_services/remote_service_admin/private/src/export_registration_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin/private/src/export_registration_impl.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin/private/src/export_registration_impl.c (original)
+++ celix/trunk/remote_services/remote_service_admin/private/src/export_registration_impl.c Wed Mar 18 20:27:29 2015
@@ -31,10 +31,6 @@
#include "export_registration_impl.h"
#include "remote_service_admin_impl.h"
-#include "service_tracker.h"
-#include "bundle_context.h"
-#include "bundle.h"
-#include "log_helper.h"
celix_status_t exportRegistration_endpointAdding(void * handle, service_reference_pt reference, void **service);
celix_status_t exportRegistration_endpointAdded(void * handle, service_reference_pt reference, void *service);
@@ -114,7 +110,7 @@ celix_status_t exportRegistration_stopTr
}
celix_status_t exportRegistration_createEndpointTracker(export_registration_pt registration, service_tracker_pt *tracker) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
service_tracker_customizer_pt customizer = NULL;
@@ -132,7 +128,7 @@ celix_status_t exportRegistration_create
}
celix_status_t exportRegistration_endpointAdding(void * handle, service_reference_pt reference, void **service) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
export_registration_pt registration = handle;
status = bundleContext_getService(registration->context, reference, service);
@@ -140,11 +136,11 @@ celix_status_t exportRegistration_endpoi
return status;
}
-celix_status_t exportRegistration_endpointAdded(void * handle, service_reference_pt reference, void *service) {
+celix_status_t exportRegistration_endpointAdded(void * handle, service_reference_pt reference, void *endpoint_service) {
celix_status_t status = CELIX_SUCCESS;
export_registration_pt registration = handle;
- remote_endpoint_service_pt endpoint = service;
+ remote_endpoint_service_pt endpoint = endpoint_service;
if (registration->endpoint == NULL) {
registration->endpoint = endpoint;
void *service = NULL;
@@ -178,7 +174,7 @@ celix_status_t exportRegistration_endpoi
}
celix_status_t exportRegistration_open(export_registration_pt registration) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
char *bundleStore = NULL;
bundleContext_getProperty(registration->context, BUNDLE_STORE_PROPERTY_NAME, &bundleStore);
Modified: celix/trunk/remote_services/remote_service_admin/private/src/import_registration_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin/private/src/import_registration_impl.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin/private/src/import_registration_impl.c (original)
+++ celix/trunk/remote_services/remote_service_admin/private/src/import_registration_impl.c Wed Mar 18 20:27:29 2015
@@ -32,10 +32,6 @@
#include "import_registration_impl.h"
#include "remote_service_admin_impl.h"
-#include "remote_proxy.h"
-#include "service_tracker.h"
-#include "bundle_context.h"
-#include "bundle.h"
celix_status_t importRegistration_proxyFactoryAdding(void * handle, service_reference_pt reference, void **service);
@@ -109,7 +105,7 @@ celix_status_t importRegistrationFactory
celix_status_t importRegistrationFactory_open(import_registration_factory_pt registration_factory)
{
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
char *bundleStore = NULL;
bundleContext_getProperty(registration_factory->context, BUNDLE_STORE_PROPERTY_NAME, &bundleStore);
@@ -154,7 +150,7 @@ celix_status_t importRegistrationFactory
celix_status_t importRegistration_createProxyFactoryTracker(import_registration_factory_pt registration_factory, service_tracker_pt *tracker) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
service_tracker_customizer_pt customizer = NULL;
status = serviceTrackerCustomizer_create(registration_factory, importRegistration_proxyFactoryAdding, importRegistration_proxyFactoryAdded, importRegistration_proxyFactoryModified, importRegistration_proxyFactoryRemoved, &customizer);
@@ -212,7 +208,7 @@ celix_status_t importRegistration_proxyF
celix_status_t importRegistrationFactory_install(log_helper_pt helper, char* serviceName, bundle_context_pt context, import_registration_factory_pt *registration_factory)
{
- celix_status_t status = CELIX_BUNDLE_EXCEPTION;
+ celix_status_t status;
if ( (status = importRegistrationFactory_create(helper, serviceName, context, registration_factory)) == CELIX_SUCCESS) {
// starting the proxy tracker first allows us to pick up already available proxy factories
Modified: celix/trunk/remote_services/remote_service_admin/private/src/remote_proxy_factory_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin/private/src/remote_proxy_factory_impl.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin/private/src/remote_proxy_factory_impl.c (original)
+++ celix/trunk/remote_services/remote_service_admin/private/src/remote_proxy_factory_impl.c Wed Mar 18 20:27:29 2015
@@ -218,9 +218,7 @@ static celix_status_t remoteProxyFactory
if (proxy_instance_ptr->properties) {
properties_destroy(proxy_instance_ptr->properties);
}
- if (proxy_instance_ptr) {
- free(proxy_instance_ptr);
- }
+ free(proxy_instance_ptr);
}
return status;
Modified: celix/trunk/utils/private/src/array_list.c
URL: http://svn.apache.org/viewvc/celix/trunk/utils/private/src/array_list.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/utils/private/src/array_list.c (original)
+++ celix/trunk/utils/private/src/array_list.c Wed Mar 18 20:27:29 2015
@@ -53,7 +53,6 @@ void arrayList_destroy(array_list_pt lis
free(list->elementData);
list->elementData = NULL;
free(list);
- list = NULL;
}
static celix_status_t arrayList_elementEquals(void *a, void *b, bool *equals) {
@@ -74,11 +73,11 @@ void arrayList_trimToSize(array_list_pt
void arrayList_ensureCapacity(array_list_pt list, int capacity) {
void ** newList;
- int oldCapacity;
+ unsigned int oldCapacity;
list->modCount++;
oldCapacity = list->capacity;
if (capacity > oldCapacity) {
- int newCapacity = (oldCapacity * 3) / 2 + 1;
+ unsigned int newCapacity = (oldCapacity * 3) / 2 + 1;
if (newCapacity < capacity) {
newCapacity = capacity;
}
@@ -285,7 +284,6 @@ void arrayListIterator_destroy(array_lis
iterator->expectedModificationCount = 0;
iterator->list = NULL;
free(iterator);
- iterator = NULL;
}
bool arrayListIterator_hasNext(array_list_iterator_pt iterator) {
Modified: celix/trunk/utils/private/src/celix_threads.c
URL: http://svn.apache.org/viewvc/celix/trunk/utils/private/src/celix_threads.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/utils/private/src/celix_threads.c (original)
+++ celix/trunk/utils/private/src/celix_threads.c Wed Mar 18 20:27:29 2015
@@ -40,10 +40,9 @@ celix_status_t celixThread_create(celix_
return status;
}
-celix_status_t celixThread_exit(void *exitStatus) {
- celix_status_t status = CELIX_SUCCESS;
+// Returns void, since pthread_exit does exit the thread and never returns.
+void celixThread_exit(void *exitStatus) {
pthread_exit(exitStatus);
- return status;
}
celix_status_t celixThread_detach(celix_thread_t thread) {
@@ -57,7 +56,8 @@ celix_status_t celixThread_join(celix_th
status = CELIX_BUNDLE_EXCEPTION;
}
- thread.threadInitialized = false;
+ // #TODO make thread a pointer? Now this statement has no effect
+ // thread.threadInitialized = false;
return status;
}
@@ -105,7 +105,7 @@ celix_status_t celixThreadMutexAttr_dest
}
celix_status_t celixThreadMutexAttr_settype(celix_thread_mutexattr_t *attr, int type) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
switch(type) {
case CELIX_THREAD_MUTEX_NORMAL :
status = pthread_mutexattr_settype(attr, PTHREAD_MUTEX_NORMAL);
Modified: celix/trunk/utils/private/src/hash_map.c
URL: http://svn.apache.org/viewvc/celix/trunk/utils/private/src/hash_map.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/utils/private/src/hash_map.c (original)
+++ celix/trunk/utils/private/src/hash_map.c Wed Mar 18 20:27:29 2015
@@ -27,8 +27,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
-#include <string.h>
-#include <stdint.h>
#include "hash_map.h"
#include "hash_map_private.h"
@@ -70,7 +68,7 @@ static unsigned int hashMap_indexFor(uns
hash_map_pt hashMap_create(unsigned int (*keyHash)(void *), unsigned int (*valueHash)(void *),
int (*keyEquals)(void *, void *), int (*valueEquals)(void *, void *)) {
hash_map_pt map = (hash_map_pt) malloc(sizeof(*map));
- map->treshold = (int) (DEFAULT_INITIAL_CAPACITY * DEFAULT_LOAD_FACTOR);
+ map->treshold = (unsigned int) (DEFAULT_INITIAL_CAPACITY * DEFAULT_LOAD_FACTOR);
map->table = (hash_map_entry_pt *) calloc(DEFAULT_INITIAL_CAPACITY, sizeof(hash_map_entry_pt));
map->size = 0;
map->modificationCount = 0;
@@ -100,7 +98,6 @@ void hashMap_destroy(hash_map_pt map, bo
hashMap_clear(map, freeKeys, freeValues);
free(map->table);
free(map);
- map = NULL;
}
int hashMap_size(hash_map_pt map) {
@@ -113,9 +110,8 @@ bool hashMap_isEmpty(hash_map_pt map) {
void * hashMap_get(hash_map_pt map, void * key) {
unsigned int hash;
- hash_map_entry_pt entry;
if (key == NULL) {
- hash_map_entry_pt entry = map->table[0];
+ hash_map_entry_pt entry;
for (entry = map->table[0]; entry != NULL; entry = entry->next) {
if (entry->key == NULL) {
return entry->value;
@@ -125,7 +121,7 @@ void * hashMap_get(hash_map_pt map, void
}
hash = hashMap_hash(map->hashKey(key));
- entry = NULL;
+ hash_map_entry_pt entry = NULL;
for (entry = map->table[hashMap_indexFor(hash, map->tablelength)]; entry != NULL; entry = entry->next) {
if (entry->hash == hash && (entry->key == key || map->equalsKey(key, entry->key))) {
return entry->value;
@@ -153,7 +149,6 @@ hash_map_entry_pt hashMap_getEntry(hash_
void * hashMap_put(hash_map_pt map, void * key, void * value) {
unsigned int hash;
int i;
- hash_map_entry_pt entry = NULL;
if (key == NULL) {
hash_map_entry_pt entry;
for (entry = map->table[0]; entry != NULL; entry = entry->next) {
@@ -169,7 +164,8 @@ void * hashMap_put(hash_map_pt map, void
}
hash = hashMap_hash(map->hashKey(key));
i = hashMap_indexFor(hash, map->tablelength);
-
+
+ hash_map_entry_pt entry;
for (entry = map->table[i]; entry != NULL; entry = entry->next) {
if (entry->hash == hash && (entry->key == key || map->equalsKey(key, entry->key))) {
void * oldValue = entry->value;
@@ -217,8 +213,7 @@ void * hashMap_remove(hash_map_pt map, v
entry->key = NULL;
entry->value = NULL;
free(entry);
- entry = NULL;
- }
+ }
return value;
}
@@ -359,7 +354,6 @@ void hashMapIterator_destroy(hash_map_it
iterator->map = NULL;
iterator->next = NULL;
free(iterator);
- iterator = NULL;
}
bool hashMapIterator_hasNext(hash_map_iterator_pt iterator) {
@@ -473,7 +467,6 @@ hash_map_values_pt hashMapValues_create(
void hashMapValues_destroy(hash_map_values_pt values) {
values->map = NULL;
free(values);
- values = NULL;
}
hash_map_iterator_pt hashMapValues_iterator(hash_map_values_pt values) {
@@ -495,7 +488,6 @@ void hashMapValues_toArray(hash_map_valu
*size = vsize;
*array = malloc(vsize * sizeof(*array));
it = hashMapValues_iterator(values);
- i = 0;
for (i = 0; i < vsize; i++) {
if (!hashMapIterator_hasNext(it)) {
return;
Modified: celix/trunk/utils/private/src/linked_list.c
URL: http://svn.apache.org/viewvc/celix/trunk/utils/private/src/linked_list.c?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/utils/private/src/linked_list.c (original)
+++ celix/trunk/utils/private/src/linked_list.c Wed Mar 18 20:27:29 2015
@@ -71,7 +71,7 @@ UTILS_EXPORT celix_status_t linkedList_d
}
celix_status_t linkedList_clone(linked_list_pt list, linked_list_pt *clone) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status;
status = linkedList_create(clone);
if (status == CELIX_SUCCESS) {
Modified: celix/trunk/utils/public/include/celix_threads.h
URL: http://svn.apache.org/viewvc/celix/trunk/utils/public/include/celix_threads.h?rev=1667610&r1=1667609&r2=1667610&view=diff
==============================================================================
--- celix/trunk/utils/public/include/celix_threads.h (original)
+++ celix/trunk/utils/public/include/celix_threads.h Wed Mar 18 20:27:29 2015
@@ -48,7 +48,7 @@ static const celix_thread_t celix_thread
celix_status_t celixThread_create(celix_thread_t *new_thread, celix_thread_attr_t *attr, celix_thread_start_t func, void *data);
-celix_status_t celixThread_exit(void *exitStatus);
+void celixThread_exit(void *exitStatus);
celix_status_t celixThread_detach(celix_thread_t thread);
celix_status_t celixThread_join(celix_thread_t thread, void **status);
celix_thread_t celixThread_self();