celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpe...@apache.org
Subject svn commit: r1643718 - in /celix/trunk/log_writer/log_writer/private: include/log_writer.h src/log_writer.c src/log_writer_activator.c
Date Sun, 07 Dec 2014 20:59:45 GMT
Author: bpetri
Date: Sun Dec  7 20:59:45 2014
New Revision: 1643718

URL: http://svn.apache.org/r1643718
Log:
CELIX-119: remove apr from log_writer

Modified:
    celix/trunk/log_writer/log_writer/private/include/log_writer.h
    celix/trunk/log_writer/log_writer/private/src/log_writer.c
    celix/trunk/log_writer/log_writer/private/src/log_writer_activator.c

Modified: celix/trunk/log_writer/log_writer/private/include/log_writer.h
URL: http://svn.apache.org/viewvc/celix/trunk/log_writer/log_writer/private/include/log_writer.h?rev=1643718&r1=1643717&r2=1643718&view=diff
==============================================================================
--- celix/trunk/log_writer/log_writer/private/include/log_writer.h (original)
+++ celix/trunk/log_writer/log_writer/private/include/log_writer.h Sun Dec  7 20:59:45 2014
@@ -34,14 +34,15 @@
 struct log_writer {
     log_reader_service_pt logReader;
     log_listener_pt logListener;
-    apr_pool_t *pool;
+
     bundle_context_pt context;
     service_tracker_pt tracker;
 };
 
 typedef struct log_writer *log_writer_pt;
 
-celix_status_t logWriter_create(apr_pool_t *pool, bundle_context_pt context, log_writer_pt
*writer);
+celix_status_t logWriter_create(bundle_context_pt context, log_writer_pt *writer);
+celix_status_t logWriter_destroy(log_writer_pt *writer);
 celix_status_t logWriter_start(log_writer_pt writer);
 celix_status_t logWriter_stop(log_writer_pt writer);
 

Modified: celix/trunk/log_writer/log_writer/private/src/log_writer.c
URL: http://svn.apache.org/viewvc/celix/trunk/log_writer/log_writer/private/src/log_writer.c?rev=1643718&r1=1643717&r2=1643718&view=diff
==============================================================================
--- celix/trunk/log_writer/log_writer/private/src/log_writer.c (original)
+++ celix/trunk/log_writer/log_writer/private/src/log_writer.c Sun Dec  7 20:59:45 2014
@@ -34,24 +34,31 @@
 #include "module.h"
 #include "bundle.h"
 
-celix_status_t logWriter_create(apr_pool_t *pool, bundle_context_pt context, log_writer_pt
*writer) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    apr_pool_t *mypool;
-    apr_pool_create(&mypool, pool);
+celix_status_t logWriter_create(bundle_context_pt context, log_writer_pt *writer) {
+	celix_status_t status = CELIX_SUCCESS;
 
-    *writer = apr_pcalloc(mypool, sizeof(**writer));
-    (*writer)->logListener = apr_pcalloc(mypool, sizeof(*(*writer)->logListener));
-    (*writer)->logListener->handle = *writer;
-    (*writer)->logListener->logged = logListener_logged;
-    (*writer)->logReader = NULL;
-    (*writer)->pool = mypool;
-    (*writer)->context = context;
-    (*writer)->tracker = NULL;
+	*writer = calloc(1, sizeof(**writer));
+	(*writer)->logListener = calloc(1, sizeof(*(*writer)->logListener));
+	(*writer)->logListener->handle = *writer;
+	(*writer)->logListener->logged = logListener_logged;
+	(*writer)->logReader = NULL;
+	(*writer)->context = context;
+	(*writer)->tracker = NULL;
 
-    return status;
+	return status;
 }
 
+
+celix_status_t logWriter_destroy(log_writer_pt *writer) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	free((*writer)->logListener);
+	free(*writer);
+
+	writer = NULL;
+
+	return status;
+}
 celix_status_t logWriter_start(log_writer_pt writer) {
 	celix_status_t status = CELIX_SUCCESS;
 

Modified: celix/trunk/log_writer/log_writer/private/src/log_writer_activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/log_writer/log_writer/private/src/log_writer_activator.c?rev=1643718&r1=1643717&r2=1643718&view=diff
==============================================================================
--- celix/trunk/log_writer/log_writer/private/src/log_writer_activator.c (original)
+++ celix/trunk/log_writer/log_writer/private/src/log_writer_activator.c Sun Dec  7 20:59:45
2014
@@ -29,12 +29,9 @@
 #include "bundle_activator.h"
 
 celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
-	apr_pool_t *pool;
 	log_writer_pt writer = NULL;
 
-	bundleContext_getMemoryPool(context, &pool);
-
-	logWriter_create(pool, context, &writer);
+	logWriter_create(context, &writer);
 
 	*userData = writer;
 
@@ -42,15 +39,19 @@ celix_status_t bundleActivator_create(bu
 }
 
 celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
-	logWriter_start(userData);
-	return CELIX_SUCCESS;
+	log_writer_pt writer = (log_writer_pt) userData;
+
+	return logWriter_start(writer);
 }
 
 celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
-	logWriter_stop(userData);
-	return CELIX_SUCCESS;
+	log_writer_pt writer = (log_writer_pt) userData;
+
+	return logWriter_stop(writer);
 }
 
 celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
-    return CELIX_SUCCESS;
+	log_writer_pt writer = (log_writer_pt) userData;
+
+	return logWriter_destroy(&writer);
 }



Mime
View raw message