You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by bp...@apache.org on 2015/09/28 12:02:58 UTC
[13/19] celix git commit: CELIX-238: replace dlopen/dlsym with direct
function pointer assignment
CELIX-238: replace dlopen/dlsym with direct function pointer assignment
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/e59dea5f
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/e59dea5f
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/e59dea5f
Branch: refs/heads/feature/CELIX-247_android_support
Commit: e59dea5ff0ee58205e3ab098adcdbf9d1e3dbc20
Parents: fad8ca2
Author: Bjoern Petri <bp...@apache.org>
Authored: Fri Sep 25 18:59:14 2015 +0200
Committer: Bjoern Petri <bp...@apache.org>
Committed: Fri Sep 25 18:59:14 2015 +0200
----------------------------------------------------------------------
framework/private/src/framework.c | 26 +++++++-------------------
1 file changed, 7 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/e59dea5f/framework/private/src/framework.c
----------------------------------------------------------------------
diff --git a/framework/private/src/framework.c b/framework/private/src/framework.c
index f493318..6aad985 100644
--- a/framework/private/src/framework.c
+++ b/framework/private/src/framework.c
@@ -162,7 +162,6 @@ framework_logger_pt logger;
#ifdef _WIN32
#define handle_t HMODULE
- #define fw_getSystemLibrary() fw_getCurrentModule()
#define fw_openLibrary(path) LoadLibrary(path)
#define fw_closeLibrary(handle) FreeLibrary(handle)
@@ -177,7 +176,6 @@ framework_logger_pt logger;
}
#else
#define handle_t void *
- #define fw_getSystemLibrary() dlopen(NULL, RTLD_LAZY|RTLD_LOCAL)
#define fw_openLibrary(path) dlopen(path, RTLD_LAZY|RTLD_LOCAL)
#define fw_closeLibrary(handle) dlclose(handle)
#define fw_getSymbol(handle, name) dlsym(handle, name)
@@ -426,16 +424,6 @@ celix_status_t fw_init(framework_pt framework) {
status = CELIX_DO_IF(status, serviceRegistry_create(framework, fw_serviceChanged, &framework->registry));
status = CELIX_DO_IF(status, framework_setBundleStateAndNotify(framework, framework->bundle, OSGI_FRAMEWORK_BUNDLE_STARTING));
status = CELIX_DO_IF(status, celixThreadCondition_init(&framework->shutdownGate, NULL));
- if (status == CELIX_SUCCESS) {
- handle_t handle = NULL;
- handle = fw_getSystemLibrary();
- if (handle != NULL) {
- bundle_setHandle(framework->bundle, handle);
- } else {
- status = CELIX_FRAMEWORK_EXCEPTION;
- fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Could not get handle to framework library");
- }
- }
bundle_context_pt context = NULL;
#ifdef WITH_APR
@@ -453,10 +441,10 @@ celix_status_t fw_init(framework_pt framework) {
bundle_context_pt context = NULL;
void * userData = NULL;
- create_function_pt create = (create_function_pt) fw_getSymbol((handle_t) bundle_getHandle(framework->bundle), OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_CREATE);
- start_function_pt start = (start_function_pt) fw_getSymbol((handle_t) bundle_getHandle(framework->bundle), OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_START);
- stop_function_pt stop = (stop_function_pt) fw_getSymbol((handle_t) bundle_getHandle(framework->bundle), OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_STOP);
- destroy_function_pt destroy = (destroy_function_pt) fw_getSymbol((handle_t) bundle_getHandle(framework->bundle), OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_DESTROY);
+ create_function_pt create = NULL;
+ start_function_pt start = (start_function_pt) frameworkActivator_start;
+ stop_function_pt stop = (stop_function_pt) frameworkActivator_stop;
+ destroy_function_pt destroy = (destroy_function_pt) frameworkActivator_destroy;
activator->start = start;
activator->stop = stop;
@@ -2315,12 +2303,12 @@ celix_status_t fw_invokeFrameworkListener(framework_pt framework, framework_list
return ret;
}
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+celix_status_t frameworkActivator_start(void * userData, bundle_context_pt context) {
// nothing to do
return CELIX_SUCCESS;
}
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+celix_status_t frameworkActivator_stop(void * userData, bundle_context_pt context) {
celix_status_t status = CELIX_SUCCESS;
celix_thread_t shutdownThread;
@@ -2345,7 +2333,7 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context)
return status;
}
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+celix_status_t frameworkActivator_destroy(void * userData, bundle_context_pt context) {
return CELIX_SUCCESS;
}