You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2016/08/24 10:17:57 UTC

celix git commit: CELIX-256: Removes usage of unneeded double pointers, removes some memory leaks

Repository: celix
Updated Branches:
  refs/heads/feature/event_admin e3fd7f1b2 -> 2324b9f74


CELIX-256: Removes usage of unneeded double pointers, removes some memory leaks


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

Branch: refs/heads/feature/event_admin
Commit: 2324b9f74607b0373d2727846fe2d193a1c1c695
Parents: e3fd7f1
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Wed Aug 24 12:14:41 2016 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Wed Aug 24 12:14:41 2016 +0200

----------------------------------------------------------------------
 CMakeLists.txt                                  |   2 +-
 event_admin/CMakeLists.txt                      |  21 ++--
 .../private/include/event_admin_impl.h          |  38 +++----
 .../private/src/event_admin_activator.c         |   8 +-
 .../event_admin/private/src/event_admin_impl.c  | 100 +++++++++----------
 .../event_admin/private/src/event_impl.c        |  30 +++---
 .../event_admin/public/include/event_admin.h    |  27 ++---
 .../private/src/event_handler_activator.c       |   2 +-
 .../private/src/event_handler_impl.c            |   8 +-
 9 files changed, 122 insertions(+), 114 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/2324b9f7/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bfa37e1..9083ed9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -81,7 +81,7 @@ add_subdirectory(shell)
 add_subdirectory(log_writer)
 add_subdirectory(log_service)
 
-add_subdirectory(event_admin)# event_admin is unstable
+add_subdirectory(event_admin)
 add_subdirectory(dependency_manager)
 add_subdirectory(dependency_manager_cxx)
 #add_subdirectory(scr) scr still needs APR

http://git-wip-us.apache.org/repos/asf/celix/blob/2324b9f7/event_admin/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/event_admin/CMakeLists.txt b/event_admin/CMakeLists.txt
index 60e1b0f..df5f787 100644
--- a/event_admin/CMakeLists.txt
+++ b/event_admin/CMakeLists.txt
@@ -23,16 +23,15 @@ if(EVENT_ADMIN)
 	add_subdirectory(event_publisher)
 
 	add_deploy(event_admin_service
-			NAME "event_admin_service"
-			GROUP "event_admin"
-			BUNDLES event_admin shell_tui shell log_writer log_service
-			)
-	add_deploy(event_handler_consumer
-			NAME "event_handler_consumer"
-			GROUP "event_handler"
-			BUNDLES event_handler shell_tui shell log_writer log_service)
+	    NAME "event_admin_service"
+	    GROUP "event_admin"
+	    BUNDLES event_admin shell_tui shell log_writer log_service
+	)
+
 	add_deploy(event_publisher_consumer
-			NAME "event_publisher_consumer"
-			GROUP "event_publisher"
-			BUNDLES event_publisher event_handler event_admin shell_tui shell log_writer log_service)
+	    NAME "example"
+	    GROUP "event_admin"
+	    BUNDLES event_publisher event_handler event_admin shell_tui shell log_writer log_service
+    )
+
 endif(EVENT_ADMIN)

http://git-wip-us.apache.org/repos/asf/celix/blob/2324b9f7/event_admin/event_admin/private/include/event_admin_impl.h
----------------------------------------------------------------------
diff --git a/event_admin/event_admin/private/include/event_admin_impl.h b/event_admin/event_admin/private/include/event_admin_impl.h
index dbb969d..53066c0 100644
--- a/event_admin/event_admin/private/include/event_admin_impl.h
+++ b/event_admin/event_admin/private/include/event_admin_impl.h
@@ -49,10 +49,11 @@ struct event_admin {
     bundle_context_pt context;
     linked_list_pt eventList;
     celix_thread_t eventListProcessor;
-    celix_thread_mutex_t *eventListLock;
+    celix_thread_mutex_t eventListLock;
     bool eventAdminRunning;
-    celix_thread_mutex_t *topicLock;
+    celix_thread_mutex_t topicLock;
 };
+
 typedef struct channel *channel_t;
 struct channel {
     char *topic;
@@ -60,19 +61,20 @@ struct channel {
     celix_thread_mutex_t *channelLock;
 
 };
+
 /**
  * @desc Create event an event admin and put it in the event_admin parameter.
  * @param apr_pool_t *pool. Pointer to the apr pool
  * @param bundle_context_pt context. Pointer to the bundle context.
  * @param event_admin_pt *event_admin. The event admin result.
  */
-celix_status_t eventAdmin_create( bundle_context_pt context, event_admin_pt *event_admin);
+celix_status_t eventAdmin_create(bundle_context_pt context, event_admin_pt *event_admin);
 
-celix_status_t eventAdmin_start(event_admin_pt *event_admin);
+celix_status_t eventAdmin_start(event_admin_pt event_admin);
 
-celix_status_t eventAdmin_stop(event_admin_pt *event_admin);
+celix_status_t eventAdmin_stop(event_admin_pt event_admin);
 
-celix_status_t eventAdmin_destroy(event_admin_pt *event_admin);
+celix_status_t eventAdmin_destroy(event_admin_pt event_admin);
 
 /**
  * @desc Post event. sends the event to the handlers in async.
@@ -94,10 +96,10 @@ celix_status_t eventAdmin_sendEvent(event_admin_pt event_admin, event_pt event);
  * @param service_reference_pt ref. Pointer to the service reference. Needed to get the service
  * @param void **service Pointer to the service. Needed to use the service.
  */
-celix_status_t eventAdmin_addingService(void * handle, service_reference_pt ref, void **service);
-celix_status_t eventAdmin_addedService(void * handle, service_reference_pt ref, void * service);
-celix_status_t eventAdmin_modifiedService(void * handle, service_reference_pt ref, void * service);
-celix_status_t eventAdmin_removedService(void * handle, service_reference_pt ref, void * service) ;
+celix_status_t eventAdmin_addingService(void* handle, service_reference_pt ref, void **service);
+celix_status_t eventAdmin_addedService(void* handle, service_reference_pt ref, void * service);
+celix_status_t eventAdmin_modifiedService(void* handle, service_reference_pt ref, void * service);
+celix_status_t eventAdmin_removedService(void* handle, service_reference_pt ref, void * service) ;
 /*
  * end functions for service tracker
  */
@@ -133,36 +135,36 @@ celix_status_t eventAdmin_createEvent(event_admin_pt event_admin, const char *to
  * @param char *property. the key for the property to check
  * @param bool *result. the result.
  */
-celix_status_t eventAdmin_containsProperty( event_pt *event, char *property, bool *result);
+celix_status_t eventAdmin_containsProperty(event_pt event, char *property, bool *result);
 /**
  * @desc checks if an event is equal to the second event.
  * @param event_pt *event, event to compare to
  * @param event_pt *event, the event to be compared
  * @param bool *result. the result true if equal.
  */
-celix_status_t eventAdmin_event_equals( event_pt *event, event_pt *compare, bool *result);
+celix_status_t eventAdmin_event_equals(event_pt event, event_pt compare, bool *result);
 /**
  * @desc gets a property from the event.
  * @param event_pt *event. the event to get the property from
  * @param char *propertyKey the key of the property to get
  * @param char **propertyValue. the result param will contain the property if it exists in the event.
  */
-celix_status_t eventAdmin_getProperty(event_pt *event, char *propertyKey, const char **propertyValue);
+celix_status_t eventAdmin_getProperty(event_pt event, char *propertyKey, const char **propertyValue);
 /**
  * @desc gets all property names from the event
  * @param event_pt *event. the event to get the property names from
  * @param array_list_pt *names. will contain the keys
  */
-celix_status_t eventAdmin_getPropertyNames( event_pt *event, array_list_pt *names);
+celix_status_t eventAdmin_getPropertyNames(event_pt event, array_list_pt *names);
 /**
  * @desc gets the topic from an event
  * @param event_pt *event. the event to get the topic from
  * @param char **topic, result pointer will contain the topic.
  */
-celix_status_t eventAdmin_getTopic(event_pt *event, const char **topic);
-celix_status_t eventAdmin_hashCode(event_pt *event, int *hashCode);
-celix_status_t eventAdmin_matches( event_pt *event);
-celix_status_t eventAdmin_toString( event_pt *event, char *eventString);
+celix_status_t eventAdmin_getTopic(event_pt event, const char **topic);
+celix_status_t eventAdmin_hashCode(event_pt event, int *hashCode);
+celix_status_t eventAdmin_matches(event_pt event);
+celix_status_t eventAdmin_toString(event_pt event, char *eventString);
 
 celix_status_t processEvent(event_admin_pt event_admin, event_pt event);
 

http://git-wip-us.apache.org/repos/asf/celix/blob/2324b9f7/event_admin/event_admin/private/src/event_admin_activator.c
----------------------------------------------------------------------
diff --git a/event_admin/event_admin/private/src/event_admin_activator.c b/event_admin/event_admin/private/src/event_admin_activator.c
index 82a3102..f3f4d3f 100644
--- a/event_admin/event_admin/private/src/event_admin_activator.c
+++ b/event_admin/event_admin/private/src/event_admin_activator.c
@@ -101,7 +101,7 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
 		serviceTracker_open(data->tracker);
 		properties = properties_create();
 		event_admin_service = activator->event_admin_service;
-		eventAdmin_start(&event_admin_service->eventAdmin);
+		eventAdmin_start(event_admin_service->eventAdmin);
 		bundleContext_registerService(context, (char *) EVENT_ADMIN_NAME, event_admin_service, properties, &activator->registration);
 
 	}
@@ -113,7 +113,7 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context)
 	struct activator * data =  userData;
     serviceRegistration_unregister(data->registration);
 	serviceTracker_close(data->tracker);
-	eventAdmin_stop(&data->event_admin_service->eventAdmin);
+	eventAdmin_stop(data->event_admin_service->eventAdmin);
 	printf("event admin stopped\n");
 	return status;
 }
@@ -124,10 +124,12 @@ celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt contex
 	struct activator * data =  userData;
 	event_admin_pt event_admin = data->event_admin;
 	event_admin_service_pt event_admin_service = data->event_admin_service;
-	eventAdmin_destroy(&event_admin);
+	eventAdmin_destroy(event_admin);
 	free(event_admin_service);
 	serviceTracker_destroy(data->tracker);
 
+    free(data);
+
 	return status;
 }
 

http://git-wip-us.apache.org/repos/asf/celix/blob/2324b9f7/event_admin/event_admin/private/src/event_admin_impl.c
----------------------------------------------------------------------
diff --git a/event_admin/event_admin/private/src/event_admin_impl.c b/event_admin/event_admin/private/src/event_admin_impl.c
index 40cbaa1..ed54f39 100644
--- a/event_admin/event_admin/private/src/event_admin_impl.c
+++ b/event_admin/event_admin/private/src/event_admin_impl.c
@@ -42,38 +42,38 @@ celix_status_t eventAdmin_create(bundle_context_pt context, event_admin_pt *even
     } else {
         (*event_admin)->channels = hashMap_create(utils_stringHash, utils_stringHash, utils_stringEquals, utils_stringEquals);
         (*event_admin)->context =context;
-        (*event_admin)->eventListLock = calloc(1, sizeof(celix_thread_mutex_t));
         (*event_admin)->eventListProcessor = celix_thread_default;
-        (*event_admin)->topicLock = calloc(1, sizeof(celix_thread_mutex_t));
         (*event_admin)->eventAdminRunning = false;
-        linkedList_create(&(*event_admin)->eventList);//
+        linkedList_create(&(*event_admin)->eventList);
 
         status = arrayList_create(&(*event_admin)->event_handlers);
     }
 	return status;
 }
 
-celix_status_t eventAdmin_start(event_admin_pt *event_admin) {
+celix_status_t eventAdmin_start(event_admin_pt event_admin) {
     celix_status_t status = CELIX_SUCCESS;
-    status = celixThread_create(&(*event_admin)->eventListProcessor, NULL, eventProcessor, &(*event_admin));
-    celixThreadMutex_create((*event_admin)->eventListLock, NULL);
-    celixThreadMutex_create((*event_admin)->topicLock, NULL);
-    (*event_admin)->eventAdminRunning = true;
+    status = celixThread_create(&event_admin->eventListProcessor, NULL, eventProcessor, &(*event_admin));
+    celixThreadMutex_create(&event_admin->eventListLock, NULL);
+    celixThreadMutex_create(&event_admin->topicLock, NULL);
+    event_admin->eventAdminRunning = true;
     return status;
 }
 
-celix_status_t eventAdmin_stop(event_admin_pt *event_admin)
+celix_status_t eventAdmin_stop(event_admin_pt event_admin)
 {
-    (*event_admin)->eventAdminRunning = false;
+    event_admin->eventAdminRunning = false;
     return CELIX_SUCCESS;
 }
 
-celix_status_t eventAdmin_destroy(event_admin_pt *event_admin) {
+celix_status_t eventAdmin_destroy(event_admin_pt event_admin) {
 	celix_status_t status = CELIX_SUCCESS;
-    status = celixThread_join((*event_admin)->eventListProcessor, NULL);
+    status = celixThread_join(event_admin->eventListProcessor, NULL);
 
-    arrayList_destroy((*event_admin)->event_handlers);
-	free(*event_admin);
+    hashMap_destroy(event_admin->channels, false, false);
+    arrayList_destroy(event_admin->event_handlers);
+    linkedList_destroy(event_admin->eventList);
+	free(event_admin);
 
     return status;
 }
@@ -81,47 +81,47 @@ celix_status_t eventAdmin_destroy(event_admin_pt *event_admin) {
 celix_status_t eventAdmin_postEvent(event_admin_pt event_admin, event_pt event) {
     bool added = false;
     while (event_admin->eventAdminRunning && added == false) {
-        if (celixThreadMutex_tryLock(event_admin->eventListLock) == 0) {
+        if (celixThreadMutex_tryLock(&event_admin->eventListLock) == 0) {
             //linkedList_addLast(event_admin->eventList, event);
             array_list_pt event_handlers;
             array_list_pt event_and_handlers;
             const char *topic;
-            eventAdmin_getTopic(&event, &topic);
+            eventAdmin_getTopic(event, &topic);
             arrayList_create(&event_and_handlers);
             arrayList_create(&event_handlers);
             eventAdmin_findHandlersByTopic(event_admin, topic, event_handlers);
             arrayList_addIndex(event_and_handlers, 0, event);
             arrayList_addIndex(event_and_handlers, 1, event_handlers);
             linkedList_addLast(event_admin->eventList, event_and_handlers);
-            celixThreadMutex_unlock(event_admin->eventListLock);
+            celixThreadMutex_unlock(&event_admin->eventListLock);
             added = true;
         }
     }
     return CELIX_SUCCESS;
 }
 
-void *eventProcessor(void *handle) {
+void* eventProcessor(void *handle) {
     celix_status_t status = CELIX_SUCCESS;
-    event_admin_pt *eventAdminPt = handle;
+    event_admin_pt eventAdminPt = handle;
     event_pt event = NULL;
     array_list_pt event_and_handlers;
 
     arrayList_create(&event_and_handlers);
     int waitcounter = 1;
-    while ((*eventAdminPt)->eventAdminRunning) {
-        if (celixThreadMutex_tryLock((*eventAdminPt)->eventListLock) == 0) {
-            if (linkedList_isEmpty((*eventAdminPt)->eventList)) {
+    while (eventAdminPt->eventAdminRunning) {
+        if (celixThreadMutex_tryLock(&eventAdminPt->eventListLock) == 0) {
+            if (linkedList_isEmpty(eventAdminPt->eventList)) {
                 if (waitcounter < 10) {
                     waitcounter++;
                 } else {
                     waitcounter = 1;
                 }
             } else {
-                event_and_handlers = linkedList_removeFirst((*eventAdminPt)->eventList);
+                event_and_handlers = linkedList_removeFirst(eventAdminPt->eventList);
                 waitcounter = 1;
 
             }
-            celixThreadMutex_unlock((*eventAdminPt)->eventListLock);
+            celixThreadMutex_unlock(&eventAdminPt->eventListLock);
         } else {
             if (waitcounter < 10) {
                 waitcounter++;
@@ -131,38 +131,36 @@ void *eventProcessor(void *handle) {
         }
         if (arrayList_isEmpty(event_and_handlers) == false) {
             event = arrayList_get(event_and_handlers, 0);
-            array_list_pt event_handlers;
-            arrayList_create(&event_handlers);
-            event_handlers = arrayList_get(event_and_handlers, 1);
-            array_list_iterator_pt handlers_iterator = arrayListIterator_create(event_handlers);
-            while (arrayListIterator_hasNext(handlers_iterator)) {
-                event_handler_service_pt event_handler_service = (event_handler_service_pt) arrayListIterator_next(
-                        handlers_iterator);
+            array_list_pt event_handlers = arrayList_get(event_and_handlers, 1);
+            int i;
+            for (i = 0; i < arrayList_size(event_handlers); i += 1) {
+                event_handler_service_pt event_handler_service = (event_handler_service_pt) arrayList_get(event_handlers, i);
                 if (event_handler_service != NULL) {
                     event_handler_service->handle_event(&event_handler_service->event_handler, event);
                 }
             }
             const char *topic;
 
-            eventAdmin_getTopic(&event, &topic);
+            eventAdmin_getTopic(event, &topic);
             if (status == CELIX_SUCCESS) {
 
-                eventAdmin_unlockTopic((*eventAdminPt), topic);
+                eventAdmin_unlockTopic(eventAdminPt, topic);
                 event = NULL;
 
 
             } else {
                 do {
-                    status = celixThreadMutex_tryLock((*eventAdminPt)->eventListLock);
+                    status = celixThreadMutex_tryLock(&eventAdminPt->eventListLock);
                 } while (status != 0);
                 //processing event unsuccesfull since topic is locked. put event back into list for later processing.
-                linkedList_addFirst((*eventAdminPt)->eventList, event);
-                celixThreadMutex_unlock((*eventAdminPt)->eventListLock);
+                linkedList_addFirst(eventAdminPt->eventList, event);
+                celixThreadMutex_unlock(&eventAdminPt->eventListLock);
             }
         }
 
         usleep(waitcounter * 1000);
     }
+    arrayList_destroy(event_and_handlers);
     return CELIX_SUCCESS;
 }
 
@@ -171,7 +169,7 @@ celix_status_t processEvent(event_admin_pt event_admin, event_pt event) {
 
     const char *topic;
 
-    eventAdmin_getTopic(&event, &topic);
+    eventAdmin_getTopic(event, &topic);
 
     array_list_pt event_handlers;
     arrayList_create(&event_handlers);
@@ -184,13 +182,14 @@ celix_status_t processEvent(event_admin_pt event_admin, event_pt event) {
             event_handler_service->handle_event(&event_handler_service->event_handler, event);
         }
     }
+    arrayList_destroy(event_handlers);
     return status;
 }
 celix_status_t eventAdmin_sendEvent(event_admin_pt event_admin, event_pt event) {
     celix_status_t status = CELIX_SUCCESS;
     status = processEvent(event_admin, event);
     const char *topic;
-    eventAdmin_getTopic(&event, &topic);
+    eventAdmin_getTopic(event, &topic);
     status = eventAdmin_unlockTopic(event_admin, topic);
     return status;
 }
@@ -210,6 +209,7 @@ celix_status_t eventAdmin_findHandlersByTopic(event_admin_pt event_admin, const
                     arrayList_add(event_handlers,
                                   (event_handler_service_pt) hashMapIterator_nextValue(hashmap_iterator));
                 }
+                hashMapIterator_destroy(hashmap_iterator);
             }
         } else {
             status = CELIX_ILLEGAL_STATE;
@@ -228,13 +228,13 @@ celix_status_t eventAdmin_unlockTopic(event_admin_pt event_admin, const char *to
     return status;
 }
 
-celix_status_t eventAdmin_createEventChannels(event_admin_pt *event_admin, const char *topic,
+celix_status_t eventAdmin_createEventChannels(event_admin_pt event_admin, const char *topic,
 											  event_handler_service_pt event_handler_service) {
 	celix_status_t status = CELIX_SUCCESS;
     do {
-        status = celixThreadMutex_tryLock((*event_admin)->topicLock);
+        status = celixThreadMutex_tryLock(&event_admin->topicLock);
     } while (status != 0);
-    channel_t channel = hashMap_get((*event_admin)->channels, topic);
+    channel_t channel = hashMap_get(event_admin->channels, topic);
 	if (channel == NULL) {
 		//create channel
 		channel = calloc(1, sizeof(*channel));
@@ -246,53 +246,53 @@ celix_status_t eventAdmin_createEventChannels(event_admin_pt *event_admin, const
 			channel->eventHandlers = hashMap_create(NULL,NULL,NULL,NULL);
             channel->channelLock = calloc(1, sizeof(celix_thread_mutex_t));
             celixThreadMutex_create(channel->channelLock, NULL);
-			hashMap_put((*event_admin)->channels, channel_name, channel);
+			hashMap_put(event_admin->channels, channel_name, channel);
 		}
     }
     if (channel) {
         hashMap_put(channel->eventHandlers, &event_handler_service, event_handler_service);
     }
-    status = celixThreadMutex_unlock((*event_admin)->topicLock);
+    status = celixThreadMutex_unlock(&event_admin->topicLock);
 
 	return status;
 
 
 }
 
-celix_status_t eventAdmin_addingService(void * handle, service_reference_pt ref, void **service) {
+celix_status_t eventAdmin_addingService(void* handle, service_reference_pt ref, void **service) {
 	celix_status_t status = CELIX_SUCCESS;
 	event_admin_pt  event_admin = handle;
 	status = bundleContext_getService(event_admin->context, ref, service);
   	return status;
 }
 
-celix_status_t eventAdmin_addedService(void * handle, service_reference_pt ref, void * service) {
+celix_status_t eventAdmin_addedService(void* handle, service_reference_pt ref, void * service) {
 	celix_status_t status = CELIX_SUCCESS;
 	event_admin_pt event_admin = handle;
 	event_handler_service_pt event_handler_service = NULL;
 	event_handler_service = (event_handler_service_pt) service;
 	const char *topic = NULL;
 	serviceReference_getProperty(ref, (const char*)EVENT_TOPIC, &topic);
-	eventAdmin_createEventChannels(&event_admin,topic,event_handler_service);
+	eventAdmin_createEventChannels(event_admin,topic,event_handler_service);
 	return status;
 }
 
-celix_status_t eventAdmin_modifiedService(void * handle, service_reference_pt ref, void * service) {
+celix_status_t eventAdmin_modifiedService(void* handle, service_reference_pt ref, void * service) {
 /*	event_admin_pt event_admin = (event_admin_pt) handle;
 	logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "Event admin Modified");*/
 	return CELIX_SUCCESS;
 }
 
-celix_status_t eventAdmin_removedService(void * handle, service_reference_pt ref, void * service) {
+celix_status_t eventAdmin_removedService(void* handle, service_reference_pt ref, void * service) {
 	celix_status_t status = CELIX_SUCCESS;
     event_admin_pt event_admin = handle;
     do {
-        status = celixThreadMutex_tryLock(event_admin->topicLock);
+        status = celixThreadMutex_tryLock(&event_admin->topicLock);
     } while (status != 0);
     const char *topic = NULL;
     serviceReference_getProperty(ref, (const char *) EVENT_TOPIC, &topic);
     channel_t channel = hashMap_get(event_admin->channels, topic);
     hashMap_remove(channel->eventHandlers, &service);
-    status = celixThreadMutex_unlock(event_admin->topicLock);
+    status = celixThreadMutex_unlock(&event_admin->topicLock);
 	return status;
 }

http://git-wip-us.apache.org/repos/asf/celix/blob/2324b9f7/event_admin/event_admin/private/src/event_impl.c
----------------------------------------------------------------------
diff --git a/event_admin/event_admin/private/src/event_impl.c b/event_admin/event_admin/private/src/event_impl.c
index 5a95474..3f8099c 100644
--- a/event_admin/event_admin/private/src/event_impl.c
+++ b/event_admin/event_admin/private/src/event_impl.c
@@ -51,12 +51,12 @@ celix_status_t eventAdmin_createEvent(event_admin_pt event_admin, const char *to
 	return status;
 }
 
-celix_status_t eventAdmin_containsProperty( event_pt *event, char *property, bool *result){
+celix_status_t eventAdmin_containsProperty(event_pt event, char *property, bool *result){
 	celix_status_t status = CELIX_SUCCESS;
-	if((*event)==NULL || property == NULL){
+	if(event==NULL || property == NULL){
 		status = CELIX_BUNDLE_EXCEPTION;
 	}else {
-		const char *propertyValue = properties_get((*event)->properties, property);
+		const char *propertyValue = properties_get(event->properties, property);
 		if(propertyValue == NULL){
 			(*result)= false;
 		}else {
@@ -66,13 +66,13 @@ celix_status_t eventAdmin_containsProperty( event_pt *event, char *property, boo
 	return status;
 }
 
-celix_status_t eventAdmin_event_equals( event_pt *event, event_pt *compare, bool *result){
+celix_status_t eventAdmin_event_equals(event_pt event, event_pt compare, bool *result){
 	celix_status_t status = CELIX_SUCCESS;
 	if(event == compare){
 		(*result) = true;
 	}else {
-		int sizeofEvent = hashMap_size((*event)->properties);
-		int sizeofCompare = hashMap_size((*compare)->properties);
+		int sizeofEvent = hashMap_size(event->properties);
+		int sizeofCompare = hashMap_size(compare->properties);
 		if(sizeofEvent == sizeofCompare){
 			(*result) = true;
 		}else {
@@ -82,16 +82,16 @@ celix_status_t eventAdmin_event_equals( event_pt *event, event_pt *compare, bool
 	return status;
 }
 
-celix_status_t eventAdmin_getProperty(event_pt *event, char *propertyKey, const char **propertyValue) {
+celix_status_t eventAdmin_getProperty(event_pt event, char *propertyKey, const char **propertyValue) {
 	celix_status_t status = CELIX_SUCCESS;
-	*propertyValue = properties_get((*event)->properties,propertyKey);
+	*propertyValue = properties_get(event->properties,propertyKey);
 
 	return status;
 }
 
-celix_status_t eventAdmin_getPropertyNames( event_pt *event, array_list_pt *names){
+celix_status_t eventAdmin_getPropertyNames(event_pt event, array_list_pt *names){
 	celix_status_t status = CELIX_SUCCESS;
-	properties_pt properties =  (*event)->properties;
+	properties_pt properties =  event->properties;
 	if (hashMap_size(properties) > 0) {
 		hash_map_iterator_pt iterator = hashMapIterator_create(properties);
 		while (hashMapIterator_hasNext(iterator)) {
@@ -103,26 +103,26 @@ celix_status_t eventAdmin_getPropertyNames( event_pt *event, array_list_pt *name
 	return status;
 }
 
-celix_status_t eventAdmin_getTopic(event_pt *event, const char **topic) {
+celix_status_t eventAdmin_getTopic(event_pt event, const char **topic) {
 	celix_status_t status = CELIX_SUCCESS;
 	const char *value;
-	value = properties_get((*event)->properties,(char*) EVENT_TOPIC);
+	value = properties_get(event->properties,(char*) EVENT_TOPIC);
 	*topic = value;
 
 	return status;
 }
 
-celix_status_t eventAdmin_hashCode( event_pt *event, int *hashCode){
+celix_status_t eventAdmin_hashCode(event_pt event, int *hashCode){
 	celix_status_t status = CELIX_SUCCESS;
 	return status;
 }
 
-celix_status_t eventAdmin_matches( event_pt *event){
+celix_status_t eventAdmin_matches(event_pt event){
 	celix_status_t status = CELIX_SUCCESS;
 	return status;
 }
 
-celix_status_t eventAdmin_toString( event_pt *event, char *eventString){
+celix_status_t eventAdmin_toString(event_pt event, char *eventString){
 	celix_status_t status = CELIX_SUCCESS;
 	return status;
 }

http://git-wip-us.apache.org/repos/asf/celix/blob/2324b9f7/event_admin/event_admin/public/include/event_admin.h
----------------------------------------------------------------------
diff --git a/event_admin/event_admin/public/include/event_admin.h b/event_admin/event_admin/public/include/event_admin.h
index 2cd49cc..c8f4c5d 100644
--- a/event_admin/event_admin/public/include/event_admin.h
+++ b/event_admin/event_admin/public/include/event_admin.h
@@ -30,15 +30,18 @@
 
 #include "listener_hook_service.h"
 
-static const char *const EVENT_ADMIN_NAME = "org.osgi.service.event.EventAdmin";
-typedef struct event_admin *event_admin_pt;
-typedef struct event_admin_service *event_admin_service_pt;
+#define EVENT_ADMIN_NAME "org.osgi.service.event.EventAdmin"
+typedef struct event_admin* event_admin_pt;
+
+typedef struct event_admin_service event_admin_service_t;
+typedef event_admin_service_t* event_admin_service_pt;
 
 struct event {
 	const char *topic;
 	properties_pt properties;
 };
-typedef struct event *event_pt;
+typedef struct event event_t;
+typedef event_t* event_pt;
 
 /**
  * @desc service description for the event admin.
@@ -53,16 +56,16 @@ struct event_admin_service {
 
 	celix_status_t (*createEvent)(event_admin_pt event_admin, const char *topic, properties_pt properties,
 								  event_pt *event);
-	celix_status_t (*containsProperty)(event_pt *event, char *property, bool *result);
-	celix_status_t (*event_equals)(event_pt *event, event_pt *compare, bool *result);
+	celix_status_t (*containsProperty)(event_pt event, char *property, bool *result);
+	celix_status_t (*event_equals)(event_pt event, event_pt compare, bool *result);
 
-	celix_status_t (*getProperty)(event_pt *event, char *propertyKey, const char **propertyValue);
-	celix_status_t (*getPropertyNames)(event_pt *event, array_list_pt *names);
+	celix_status_t (*getProperty)(event_pt event, char *propertyKey, const char **propertyValue);
+	celix_status_t (*getPropertyNames)(event_pt event, array_list_pt *names);
 
-	celix_status_t (*getTopic)(event_pt *event, const char **topic);
-	celix_status_t (*hashCode)(event_pt *event, int *hashCode);
-	celix_status_t (*matches)( event_pt *event);
-	celix_status_t (*toString)( event_pt *event, char *eventString);
+	celix_status_t (*getTopic)(event_pt event, const char **topic);
+	celix_status_t (*hashCode)(event_pt event, int *hashCode);
+	celix_status_t (*matches)(event_pt event);
+	celix_status_t (*toString)(event_pt event, char *eventString);
 
 };
 

http://git-wip-us.apache.org/repos/asf/celix/blob/2324b9f7/event_admin/event_handler/private/src/event_handler_activator.c
----------------------------------------------------------------------
diff --git a/event_admin/event_handler/private/src/event_handler_activator.c b/event_admin/event_handler/private/src/event_handler_activator.c
index c4b20b9..5a51052 100644
--- a/event_admin/event_handler/private/src/event_handler_activator.c
+++ b/event_admin/event_handler/private/src/event_handler_activator.c
@@ -48,7 +48,7 @@ celix_status_t bundleActivator_create(bundle_context_pt context, void **userData
 
     status = eventHandlerCreate(context, &event_handler);
     if (status == CELIX_SUCCESS) {
-        event_handler_service = calloc(1, sizeof(event_handler_service));
+        event_handler_service = calloc(1, sizeof(*event_handler_service));
         if (!event_handler_service) {
             status = CELIX_ENOMEM;
         } else {

http://git-wip-us.apache.org/repos/asf/celix/blob/2324b9f7/event_admin/event_handler/private/src/event_handler_impl.c
----------------------------------------------------------------------
diff --git a/event_admin/event_handler/private/src/event_handler_impl.c b/event_admin/event_handler/private/src/event_handler_impl.c
index 76f2367..186a2ed 100644
--- a/event_admin/event_handler/private/src/event_handler_impl.c
+++ b/event_admin/event_handler/private/src/event_handler_impl.c
@@ -71,9 +71,9 @@ celix_status_t eventHandlerHandleEvent(event_handler_pt *event_handler, event_pt
 		arrayList_create(&propertyNames);
         properties_pt properties = event->properties;
         if (hashMap_size(properties) > 0) {
-            hash_map_iterator_pt iterator = hashMapIterator_create(properties);
-            while (hashMapIterator_hasNext(iterator)) {
-                hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
+            hash_map_iterator_t iterator = hashMapIterator_construct(properties);
+            while (hashMapIterator_hasNext(&iterator)) {
+                hash_map_entry_pt entry = hashMapIterator_nextEntry(&iterator);
                 char *key = hashMapEntry_getKey(entry);
                 arrayList_add(propertyNames, key);
             }
@@ -87,6 +87,8 @@ celix_status_t eventHandlerHandleEvent(event_handler_pt *event_handler, event_pt
 
 			logHelper_log((*event_handler)->loghelper, OSGI_LOGSERVICE_INFO, "[SUB] Key: %s value: %s.", key, value);
 		}
+        arrayListIterator_destroy(propertyIter);
+        arrayList_destroy(propertyNames);
 	}
 	return status;
 }