celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1655824 - in /celix/trunk: framework/private/integration-test/test_launcher/src/ remote_services/calculator_endpoint2/private/include/ remote_services/calculator_endpoint2/private/src/ remote_services/calculator_service/private/include/ re...
Date Thu, 29 Jan 2015 19:28:24 GMT
Author: abroekhuis
Date: Thu Jan 29 19:28:23 2015
New Revision: 1655824

URL: http://svn.apache.org/r1655824
Log:
CELIX-209: Remove APR

Modified:
    celix/trunk/framework/private/integration-test/test_launcher/src/launcher.c
    celix/trunk/remote_services/calculator_endpoint2/private/include/calculator_endpoint_impl.h
    celix/trunk/remote_services/calculator_endpoint2/private/src/calculator_endpoint_activator.c
    celix/trunk/remote_services/calculator_endpoint2/private/src/calculator_endpoint_impl.c
    celix/trunk/remote_services/calculator_service/private/include/calculator_impl.h
    celix/trunk/remote_services/calculator_service/private/src/calculator_activator.c
    celix/trunk/remote_services/calculator_service/private/src/calculator_impl.c
    celix/trunk/remote_services/calculator_shell/private/src/add_command.c
    celix/trunk/remote_services/calculator_shell/private/src/calculator_shell_activator.c
    celix/trunk/remote_services/calculator_shell/private/src/sqrt_command.c
    celix/trunk/remote_services/calculator_shell/private/src/sub_command.c
    celix/trunk/remote_services/discovery_bonjour/private/src/discovery.c
    celix/trunk/remote_services/discovery_bonjour/private/src/discovery_activator.c
    celix/trunk/remote_services/discovery_shm/private/include/discovery.h
    celix/trunk/remote_services/discovery_shm/private/src/discovery.c
    celix/trunk/remote_services/discovery_shm/private/src/discovery_activator.c
    celix/trunk/remote_services/discovery_slp/private/src/discovery.c
    celix/trunk/shell_bonjour/private/src/activator.c
    celix/trunk/utils/private/test/array_list_test.c
    celix/trunk/utils/private/test/linked_list_test.c

Modified: celix/trunk/framework/private/integration-test/test_launcher/src/launcher.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/integration-test/test_launcher/src/launcher.c?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/framework/private/integration-test/test_launcher/src/launcher.c (original)
+++ celix/trunk/framework/private/integration-test/test_launcher/src/launcher.c Thu Jan 29
19:28:23 2015
@@ -28,7 +28,6 @@
 #include <stdlib.h>
 #include <signal.h>
 #include <apr_general.h>
-#include <apr_strings.h>
 #include <unistd.h>
 
 #include "framework_private.h"

Modified: celix/trunk/remote_services/calculator_endpoint2/private/include/calculator_endpoint_impl.h
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/calculator_endpoint2/private/include/calculator_endpoint_impl.h?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/remote_services/calculator_endpoint2/private/include/calculator_endpoint_impl.h
(original)
+++ celix/trunk/remote_services/calculator_endpoint2/private/include/calculator_endpoint_impl.h
Thu Jan 29 19:28:23 2015
@@ -27,14 +27,13 @@
 #ifndef CALCULATOR_ENDPOINT_IMPL_H_
 #define CALCULATOR_ENDPOINT_IMPL_H_
 
-#include <apr_general.h>
-
 #include "celix_errno.h"
 #include "remote_endpoint_impl.h"
 
 #include "calculator_service.h"
 
-celix_status_t calculatorEndpoint_create(apr_pool_t *pool, remote_endpoint_pt *endpoint);
+celix_status_t calculatorEndpoint_create(remote_endpoint_pt *endpoint);
+celix_status_t calculatorEndpoint_destroy(remote_endpoint_pt *endpoint);
 
 celix_status_t calculatorEndpoint_setService(remote_endpoint_pt endpoint, void *service);
 

Modified: celix/trunk/remote_services/calculator_endpoint2/private/src/calculator_endpoint_activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/calculator_endpoint2/private/src/calculator_endpoint_activator.c?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/remote_services/calculator_endpoint2/private/src/calculator_endpoint_activator.c
(original)
+++ celix/trunk/remote_services/calculator_endpoint2/private/src/calculator_endpoint_activator.c
Thu Jan 29 19:28:23 2015
@@ -31,33 +31,23 @@
 #include "service_registration.h"
 
 struct activator {
-	apr_pool_t *pool;
-
-	service_registration_pt endpoint;
+	remote_endpoint_service_pt endpointService;
+	service_registration_pt endpointServiceRegistration;
 };
 
 celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
 	celix_status_t status = CELIX_SUCCESS;
 
-	apr_pool_t *parentPool = NULL;
-	apr_pool_t *pool = NULL;
 	struct activator *activator;
 
-	status = bundleContext_getMemoryPool(context, &parentPool);
-	if (status == CELIX_SUCCESS) {
-		if (apr_pool_create(&pool, parentPool) != APR_SUCCESS) {
-			status = CELIX_BUNDLE_EXCEPTION;
-		} else {
-			activator = apr_palloc(pool, sizeof(*activator));
-			if (!activator) {
-				status = CELIX_ENOMEM;
-			} else {
-				activator->pool = pool;
-				activator->endpoint = NULL;
-
-				*userData = activator;
-			}
-		}
+	activator = calloc(1, sizeof(*activator));
+	if (!activator) {
+		status = CELIX_ENOMEM;
+	} else {
+		activator->endpointService = NULL;
+		activator->endpointServiceRegistration = NULL;
+
+		*userData = activator;
 	}
 
 	return status;
@@ -69,8 +59,8 @@ celix_status_t bundleActivator_start(voi
 	remote_endpoint_pt endpoint = NULL;
 	remote_endpoint_service_pt endpointService = NULL;
 
-	calculatorEndpoint_create(activator->pool, &endpoint);
-	endpointService = apr_palloc(activator->pool, sizeof(*endpointService));
+	calculatorEndpoint_create(&endpoint);
+	endpointService = calloc(1, sizeof(*endpointService));
 	endpointService->endpoint = endpoint;
 	endpointService->handleRequest = calculatorEndpoint_handleRequest;
 	endpointService->setService = calculatorEndpoint_setService;
@@ -78,8 +68,9 @@ celix_status_t bundleActivator_start(voi
 	properties_pt props = properties_create();
 	properties_set(props, (char *) "remote.interface", (char *) CALCULATOR_SERVICE);
 
-	bundleContext_registerService(context, OSGI_RSA_REMOTE_ENDPOINT, endpointService, props,
&activator->endpoint);
+	bundleContext_registerService(context, OSGI_RSA_REMOTE_ENDPOINT, endpointService, props,
&activator->endpointServiceRegistration);
 
+	activator->endpointService = endpointService;
 
 	return status;
 }
@@ -88,12 +79,18 @@ celix_status_t bundleActivator_stop(void
 	celix_status_t status = CELIX_SUCCESS;
 	struct activator *activator = userData;
 
-	serviceRegistration_unregister(activator->endpoint);
+	serviceRegistration_unregister(activator->endpointServiceRegistration);
+
+	free(activator->endpointService->endpoint);
+	free(activator->endpointService);
 
 	return status;
 }
 
 celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
 	celix_status_t status = CELIX_SUCCESS;
+	struct activator *activator = userData;
+
+	free(activator);
 	return status;
 }

Modified: celix/trunk/remote_services/calculator_endpoint2/private/src/calculator_endpoint_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/calculator_endpoint2/private/src/calculator_endpoint_impl.c?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/remote_services/calculator_endpoint2/private/src/calculator_endpoint_impl.c
(original)
+++ celix/trunk/remote_services/calculator_endpoint2/private/src/calculator_endpoint_impl.c
Thu Jan 29 19:28:23 2015
@@ -24,14 +24,15 @@
  *  \copyright	Apache License, Version 2.0
  */
 #include <jansson.h>
+#include <string.h>
 
 #include "celix_errno.h"
 
 #include "calculator_endpoint_impl.h"
 
-celix_status_t calculatorEndpoint_create(apr_pool_t *pool, remote_endpoint_pt *endpoint)
{
+celix_status_t calculatorEndpoint_create(remote_endpoint_pt *endpoint) {
 	celix_status_t status = CELIX_SUCCESS;
-	*endpoint = apr_palloc(pool, sizeof(**endpoint));
+	*endpoint = calloc(1, sizeof(**endpoint));
 	if (!*endpoint) {
 		status = CELIX_ENOMEM;
 	} else {
@@ -41,6 +42,14 @@ celix_status_t calculatorEndpoint_create
 	return status;
 }
 
+celix_status_t calculatorEndpoint_destroy(remote_endpoint_pt *endpoint) {
+	celix_status_t status = CELIX_SUCCESS;
+	free(*endpoint);
+	*endpoint = NULL;
+
+	return status;
+}
+
 celix_status_t calculatorEndpoint_setService(remote_endpoint_pt endpoint, void *service)
{
 	celix_status_t status = CELIX_SUCCESS;
 	endpoint->service = service;
@@ -68,6 +77,8 @@ celix_status_t calculatorEndpoint_handle
 		status = CELIX_ILLEGAL_ARGUMENT;
 	}
 
+	json_decref(root);
+
 	return status;
 }
 
@@ -93,10 +104,13 @@ celix_status_t calculatorEndpoint_add(re
 
 			char *c = json_dumps(resultRoot, 0);
 			*reply = c;
+
+			json_decref(resultRoot);
 		} else {
 			printf("CALCULATOR_ENDPOINT: No service available");
 			status = CELIX_BUNDLE_EXCEPTION;
 		}
+		json_decref(root);
 	}
 
 	return status;
@@ -124,10 +138,13 @@ celix_status_t calculatorEndpoint_sub(re
 
 			char *c = json_dumps(resultRoot, JSON_ENCODE_ANY);
 			*reply = c;
+
+			json_decref(resultRoot);
 		} else {
 			printf("CALCULATOR_ENDPOINT: No service available");
 			status = CELIX_BUNDLE_EXCEPTION;
 		}
+		json_decref(root);
 	}
 
 	return status;
@@ -154,10 +171,13 @@ celix_status_t calculatorEndpoint_sqrt(r
 
 			char *c = json_dumps(resultRoot, JSON_ENCODE_ANY);
 			*reply = c;
+
+			json_decref(resultRoot);
 		} else {
 			printf("CALCULATOR_ENDPOINT: No service available");
 			status = CELIX_BUNDLE_EXCEPTION;
 		}
+		json_decref(root);
 	}
 
 	return status;

Modified: celix/trunk/remote_services/calculator_service/private/include/calculator_impl.h
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/calculator_service/private/include/calculator_impl.h?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/remote_services/calculator_service/private/include/calculator_impl.h (original)
+++ celix/trunk/remote_services/calculator_service/private/include/calculator_impl.h Thu Jan
29 19:28:23 2015
@@ -27,17 +27,15 @@
 #ifndef CALCULATOR_IMPL_H_
 #define CALCULATOR_IMPL_H_
 
-#include <apr_general.h>
-
 #include "celix_errno.h"
 
 #include "calculator_service.h"
 
 struct calculator {
-	apr_pool_t *pool;
 };
 
-celix_status_t calculator_create(apr_pool_t *pool, calculator_pt *calcuator);
+celix_status_t calculator_create(calculator_pt *calcuator);
+celix_status_t calculator_destroy(calculator_pt *calcuator);
 celix_status_t calculator_add(calculator_pt calcuator, double a, double b, double *result);
 celix_status_t calculator_sub(calculator_pt calcuator, double a, double b, double *result);
 celix_status_t calculator_sqrt(calculator_pt calcuator, double a, double *result);

Modified: celix/trunk/remote_services/calculator_service/private/src/calculator_activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/calculator_service/private/src/calculator_activator.c?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/remote_services/calculator_service/private/src/calculator_activator.c (original)
+++ celix/trunk/remote_services/calculator_service/private/src/calculator_activator.c Thu
Jan 29 19:28:23 2015
@@ -33,29 +33,25 @@
 #include "remote_constants.h"
 
 struct activator {
-	apr_pool_t *pool;
+	calculator_pt calculator;
+	calculator_service_pt service;
+
 	service_registration_pt calculatorReg;
 	service_registration_pt calculatorReg2;
 };
 
 celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
 	celix_status_t status = CELIX_SUCCESS;
-	apr_pool_t *parentpool = NULL;
-	apr_pool_t *pool = NULL;
 	struct activator *activator;
 
-	status = bundleContext_getMemoryPool(context, &parentpool);
-	if (status == CELIX_SUCCESS) {
-		if (apr_pool_create(&pool, parentpool) != APR_SUCCESS) {
-			status = CELIX_BUNDLE_EXCEPTION;
-		} else {
-			activator = apr_palloc(pool, sizeof(*activator));
-			activator->pool = pool;
-			activator->calculatorReg = NULL;
-			activator->calculatorReg2 = NULL;
+	activator = calloc(1, sizeof(*activator));
+	if (!activator) {
+		status = CELIX_ENOMEM;
+	} else {
+		activator->calculatorReg = NULL;
+		activator->calculatorReg2 = NULL;
 
-			*userData = activator;
-		}
+		*userData = activator;
 	}
 
 	return status;
@@ -64,29 +60,27 @@ celix_status_t bundleActivator_create(bu
 celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
 	celix_status_t status = CELIX_SUCCESS;
 	struct activator *activator = userData;
-	calculator_pt calculator = NULL;
-	calculator_service_pt service = NULL;
 	properties_pt properties = NULL;
 
-	status = calculator_create(activator->pool, &calculator);
+	status = calculator_create(&activator->calculator);
 	if (status == CELIX_SUCCESS) {
-		service = apr_palloc(activator->pool, sizeof(*service));
-		if (!service) {
+		activator->service = calloc(1, sizeof(*activator->service));
+		if (!activator->service) {
 			status = CELIX_ENOMEM;
 		} else {
-			service->calculator = calculator;
-			service->add = calculator_add;
-			service->sub = calculator_sub;
-			service->sqrt = calculator_sqrt;
+			activator->service->calculator = activator->calculator;
+			activator->service->add = calculator_add;
+			activator->service->sub = calculator_sub;
+			activator->service->sqrt = calculator_sqrt;
 
 			properties = properties_create();
 			properties_set(properties, (char *) OSGI_RSA_SERVICE_EXPORTED_INTERFACES, (char *) CALCULATOR_SERVICE);
 
-			bundleContext_registerService(context, (char *) CALCULATOR_SERVICE, service, properties,
&activator->calculatorReg);
+			bundleContext_registerService(context, (char *) CALCULATOR_SERVICE, activator->service,
properties, &activator->calculatorReg);
 
 			properties_pt properties2 = properties_create();
             properties_set(properties2, (char *) OSGI_RSA_SERVICE_EXPORTED_INTERFACES, (char
*) "org.apache.celix.calc.api.Calculator2");
-			bundleContext_registerService(context, "org.apache.celix.calc.api.Calculator2", service,
properties2, &activator->calculatorReg2);
+			bundleContext_registerService(context, "org.apache.celix.calc.api.Calculator2", activator->service,
properties2, &activator->calculatorReg2);
 		}
 	}
 
@@ -100,11 +94,17 @@ celix_status_t bundleActivator_stop(void
 	serviceRegistration_unregister(activator->calculatorReg);
 	serviceRegistration_unregister(activator->calculatorReg2);
 
+	free(activator->service);
+
+	calculator_destroy(&activator->calculator);
+
 	return status;
 }
 
 celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
 	celix_status_t status = CELIX_SUCCESS;
 
+	free(userData);
+
 	return status;
 }

Modified: celix/trunk/remote_services/calculator_service/private/src/calculator_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/calculator_service/private/src/calculator_impl.c?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/remote_services/calculator_service/private/src/calculator_impl.c (original)
+++ celix/trunk/remote_services/calculator_service/private/src/calculator_impl.c Thu Jan 29
19:28:23 2015
@@ -25,23 +25,27 @@
  */
 #include <math.h>
 
+#include <stdlib.h>
 #include <stdio.h>
 
 #include "calculator_impl.h"
 
-celix_status_t calculator_create(apr_pool_t *pool, calculator_pt *calculator) {
+celix_status_t calculator_create(calculator_pt *calculator) {
 	celix_status_t status = CELIX_SUCCESS;
 
-	*calculator = apr_palloc(pool, sizeof(**calculator));
+	*calculator = calloc(1, sizeof(**calculator));
 	if (!*calculator) {
 		status = CELIX_ENOMEM;
-	} else {
-		(*calculator)->pool = pool;
 	}
 
 	return status;
 }
 
+celix_status_t calculator_destroy(calculator_pt *calculator) {
+	free(*calculator);
+	return CELIX_SUCCESS;
+}
+
 celix_status_t calculator_add(calculator_pt calculator, double a, double b, double *result)
{
 	celix_status_t status = CELIX_SUCCESS;
 

Modified: celix/trunk/remote_services/calculator_shell/private/src/add_command.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/calculator_shell/private/src/add_command.c?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/remote_services/calculator_shell/private/src/add_command.c (original)
+++ celix/trunk/remote_services/calculator_shell/private/src/add_command.c Thu Jan 29 19:28:23
2015
@@ -27,8 +27,6 @@
 #include <stdlib.h>
 #include <ctype.h>
 
-#include <apr_strings.h>
-
 #include "array_list.h"
 #include "bundle_context.h"
 #include "add_command.h"
@@ -39,10 +37,7 @@ void addCommand_execute(command_pt comma
 celix_status_t addCommand_isNumeric(command_pt command, char *number, bool *ret);
 
 command_pt addCommand_create(bundle_context_pt context) {
-	apr_pool_t *pool;
-	bundleContext_getMemoryPool(context, &pool);
-
-    command_pt command = (command_pt) apr_palloc(pool, sizeof(*command));
+    command_pt command = (command_pt) calloc(1, sizeof(*command));
     if (command) {
 		command->bundleContext = context;
 		command->name = "add";
@@ -54,6 +49,7 @@ command_pt addCommand_create(bundle_cont
 }
 
 void addCommand_destroy(command_pt command) {
+	free(command);
 }
 
 void addCommand_execute(command_pt command, char *line, void (*out)(char *), void (*err)(char
*)) {
@@ -63,12 +59,12 @@ void addCommand_execute(command_pt comma
     status = bundleContext_getServiceReference(command->bundleContext, (char *) CALCULATOR_SERVICE,
&calculatorService);
     if (status == CELIX_SUCCESS) {
     	char *token;
-		apr_strtok(line, " ", &token);
-		char *aStr = apr_strtok(NULL, " ", &token);
+    	strtok_r(line, " ", &token);
+		char *aStr = strtok_r(NULL, " ", &token);
 		bool numeric;
 		addCommand_isNumeric(command, aStr, &numeric);
 		if (aStr != NULL && numeric) {
-			char *bStr = apr_strtok(NULL, " ", &token);
+			char *bStr = strtok_r(NULL, " ", &token);
 			addCommand_isNumeric(command, bStr, &numeric);
 			if (bStr != NULL && numeric) {
 				calculator_service_pt calculator = NULL;

Modified: celix/trunk/remote_services/calculator_shell/private/src/calculator_shell_activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/calculator_shell/private/src/calculator_shell_activator.c?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/remote_services/calculator_shell/private/src/calculator_shell_activator.c
(original)
+++ celix/trunk/remote_services/calculator_shell/private/src/calculator_shell_activator.c
Thu Jan 29 19:28:23 2015
@@ -50,14 +50,12 @@ struct activator {
 	command_service_pt sqrtCmdSrv;
 };
 
-static celix_status_t calculatorShell_createCommandService(apr_pool_t *pool, command_pt command,
command_service_pt *commandService);
+static celix_status_t calculatorShell_createCommandService(command_pt command, command_service_pt
*commandService);
 
 celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
 	celix_status_t status = CELIX_SUCCESS;
-	apr_pool_t *pool = NULL;
-	status = bundleContext_getMemoryPool(context, &pool);
 	if (status == CELIX_SUCCESS) {
-		*userData = apr_palloc(pool, sizeof(struct activator));
+		*userData = calloc(1, sizeof(struct activator));
 		if (!*userData) {
 			status = CELIX_ENOMEM;
 		} else {
@@ -81,28 +79,25 @@ celix_status_t bundleActivator_create(bu
 celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
     celix_status_t status = CELIX_SUCCESS;
 
-	apr_pool_t *pool;
 	struct activator * activator = (struct activator *) userData;
 
-	bundleContext_getMemoryPool(context, &pool);
-
 	activator->addCmd = addCommand_create(context);
-	calculatorShell_createCommandService(pool, activator->addCmd, &activator->addCmdSrv);
+	calculatorShell_createCommandService(activator->addCmd, &activator->addCmdSrv);
 	bundleContext_registerService(context, (char *) OSGI_SHELL_COMMAND_SERVICE_NAME, activator->addCmdSrv,
NULL, &activator->addCommand);
 
 	activator->subCmd = subCommand_create(context);
-	calculatorShell_createCommandService(pool, activator->subCmd, &activator->subCmdSrv);
+	calculatorShell_createCommandService(activator->subCmd, &activator->subCmdSrv);
 	bundleContext_registerService(context, (char *) OSGI_SHELL_COMMAND_SERVICE_NAME, activator->subCmdSrv,
NULL, &activator->subCommand);
 
 	activator->sqrtCmd = sqrtCommand_create(context);
-	calculatorShell_createCommandService(pool, activator->sqrtCmd, &activator->sqrtCmdSrv);
+	calculatorShell_createCommandService(activator->sqrtCmd, &activator->sqrtCmdSrv);
 	bundleContext_registerService(context, (char *) OSGI_SHELL_COMMAND_SERVICE_NAME, activator->sqrtCmdSrv,
NULL, &activator->sqrtCommand);
 
 	return status;
 }
 
-static celix_status_t calculatorShell_createCommandService(apr_pool_t *pool, command_pt command,
command_service_pt *commandService) {
-	*commandService = apr_palloc(pool, sizeof(**commandService));
+static celix_status_t calculatorShell_createCommandService(command_pt command, command_service_pt
*commandService) {
+	*commandService = calloc(1, sizeof(**commandService));
 	(*commandService)->command = command;
 	(*commandService)->executeCommand = command->executeCommand;
 	(*commandService)->getName = command_getName;
@@ -119,6 +114,10 @@ celix_status_t bundleActivator_stop(void
 	serviceRegistration_unregister(activator->subCommand);
 	serviceRegistration_unregister(activator->sqrtCommand);
 
+	free(activator->addCmdSrv);
+	free(activator->subCmdSrv);
+	free(activator->sqrtCmdSrv);
+
 	if (status == CELIX_SUCCESS) {
         addCommand_destroy(activator->addCmd);
         subCommand_destroy(activator->subCmd);
@@ -129,6 +128,7 @@ celix_status_t bundleActivator_stop(void
 }
 
 celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+	free(userData);
 	return CELIX_SUCCESS;
 }
 

Modified: celix/trunk/remote_services/calculator_shell/private/src/sqrt_command.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/calculator_shell/private/src/sqrt_command.c?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/remote_services/calculator_shell/private/src/sqrt_command.c (original)
+++ celix/trunk/remote_services/calculator_shell/private/src/sqrt_command.c Thu Jan 29 19:28:23
2015
@@ -27,8 +27,6 @@
 #include <stdlib.h>
 #include <ctype.h>
 
-#include <apr_strings.h>
-
 #include "array_list.h"
 #include "bundle_context.h"
 #include "sqrt_command.h"
@@ -39,10 +37,7 @@ void sqrtCommand_execute(command_pt comm
 celix_status_t sqrtCommand_isNumeric(command_pt command, char *number, bool *ret);
 
 command_pt sqrtCommand_create(bundle_context_pt context) {
-	apr_pool_t *pool;
-	bundleContext_getMemoryPool(context, &pool);
-
-    command_pt command = (command_pt) apr_palloc(pool, sizeof(*command));
+    command_pt command = (command_pt) calloc(1, sizeof(*command));
     if (command) {
 		command->bundleContext = context;
 		command->name = "sqrt";
@@ -54,6 +49,7 @@ command_pt sqrtCommand_create(bundle_con
 }
 
 void sqrtCommand_destroy(command_pt command) {
+	free(command);
 }
 
 void sqrtCommand_execute(command_pt command, char *line, void (*out)(char *), void (*err)(char
*)) {
@@ -63,8 +59,8 @@ void sqrtCommand_execute(command_pt comm
     status = bundleContext_getServiceReference(command->bundleContext, (char *) CALCULATOR_SERVICE,
&calculatorService);
     if (status == CELIX_SUCCESS) {
     	char *token;
-		apr_strtok(line, " ", &token);
-		char *aStr = apr_strtok(NULL, " ", &token);
+    	strtok_r(line, " ", &token);
+		char *aStr = strtok_r(NULL, " ", &token);
 		bool numeric;
 		sqrtCommand_isNumeric(command, aStr, &numeric);
 		if (aStr != NULL && numeric) {

Modified: celix/trunk/remote_services/calculator_shell/private/src/sub_command.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/calculator_shell/private/src/sub_command.c?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/remote_services/calculator_shell/private/src/sub_command.c (original)
+++ celix/trunk/remote_services/calculator_shell/private/src/sub_command.c Thu Jan 29 19:28:23
2015
@@ -27,8 +27,6 @@
 #include <stdlib.h>
 #include <ctype.h>
 
-#include <apr_strings.h>
-
 #include "array_list.h"
 #include "bundle_context.h"
 #include "sub_command.h"
@@ -39,10 +37,7 @@ void subCommand_execute(command_pt comma
 celix_status_t subCommand_isNumeric(command_pt command, char *number, bool *ret);
 
 command_pt subCommand_create(bundle_context_pt context) {
-	apr_pool_t *pool;
-	bundleContext_getMemoryPool(context, &pool);
-
-    command_pt command = (command_pt) apr_palloc(pool, sizeof(*command));
+    command_pt command = (command_pt) calloc(1, sizeof(*command));
     if (command) {
 		command->bundleContext = context;
 		command->name = "sub";
@@ -54,6 +49,7 @@ command_pt subCommand_create(bundle_cont
 }
 
 void subCommand_destroy(command_pt command) {
+	free(command);
 }
 
 void subCommand_execute(command_pt command, char *line, void (*out)(char *), void (*err)(char
*)) {
@@ -63,12 +59,12 @@ void subCommand_execute(command_pt comma
     status = bundleContext_getServiceReference(command->bundleContext, (char *) CALCULATOR_SERVICE,
&calculatorService);
     if (status == CELIX_SUCCESS) {
     	char *token;
-		apr_strtok(line, " ", &token);
-		char *aStr = apr_strtok(NULL, " ", &token);
+    	strtok_r(line, " ", &token);
+		char *aStr = strtok_r(NULL, " ", &token);
 		bool numeric;
 		subCommand_isNumeric(command, aStr, &numeric);
 		if (aStr != NULL && numeric) {
-			char *bStr = apr_strtok(NULL, " ", &token);
+			char *bStr = strtok_r(NULL, " ", &token);
 			subCommand_isNumeric(command, bStr, &numeric);
 			if (bStr != NULL && numeric) {
 				calculator_service_pt calculator = NULL;

Modified: celix/trunk/remote_services/discovery_bonjour/private/src/discovery.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_bonjour/private/src/discovery.c?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_bonjour/private/src/discovery.c (original)
+++ celix/trunk/remote_services/discovery_bonjour/private/src/discovery.c Thu Jan 29 19:28:23
2015
@@ -25,7 +25,6 @@
  */
 #include <stdio.h>
 #include <stdlib.h>
-#include <apr_strings.h>
 #include <unistd.h>
 #include <stdbool.h>
 #include <apr_thread_proc.h>

Modified: celix/trunk/remote_services/discovery_bonjour/private/src/discovery_activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_bonjour/private/src/discovery_activator.c?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_bonjour/private/src/discovery_activator.c (original)
+++ celix/trunk/remote_services/discovery_bonjour/private/src/discovery_activator.c Thu Jan
29 19:28:23 2015
@@ -27,7 +27,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include <apr_strings.h>
 #include <apr_uuid.h>
 
 #include "bundle_activator.h"

Modified: celix/trunk/remote_services/discovery_shm/private/include/discovery.h
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_shm/private/include/discovery.h?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_shm/private/include/discovery.h (original)
+++ celix/trunk/remote_services/discovery_shm/private/include/discovery.h Thu Jan 29 19:28:23
2015
@@ -37,7 +37,6 @@
 #define DISCOVERY_SHM_SRVC_PROPERTIES "srvc.props"
 
 
-#include <apr_strings.h>
 #include <apr_thread_proc.h>
 #include "endpoint_listener.h"
 

Modified: celix/trunk/remote_services/discovery_shm/private/src/discovery.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_shm/private/src/discovery.c?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_shm/private/src/discovery.c (original)
+++ celix/trunk/remote_services/discovery_shm/private/src/discovery.c Thu Jan 29 19:28:23
2015
@@ -28,7 +28,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#include <apr_strings.h>
 #include <apr_thread_proc.h>
 
 #include <sys/types.h>

Modified: celix/trunk/remote_services/discovery_shm/private/src/discovery_activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_shm/private/src/discovery_activator.c?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_shm/private/src/discovery_activator.c (original)
+++ celix/trunk/remote_services/discovery_shm/private/src/discovery_activator.c Thu Jan 29
19:28:23 2015
@@ -27,7 +27,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include <apr_strings.h>
 #include <apr_uuid.h>
 
 #include "bundle_activator.h"

Modified: celix/trunk/remote_services/discovery_slp/private/src/discovery.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_slp/private/src/discovery.c?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_slp/private/src/discovery.c (original)
+++ celix/trunk/remote_services/discovery_slp/private/src/discovery.c Thu Jan 29 19:28:23
2015
@@ -455,15 +455,15 @@ SLPBoolean discovery_pollSLPCallback(SLP
 
 				properties_pt props = properties_create();
 				char *track;
-				char *token = apr_strtok(slpService->attributes, ",", &track);
+				char *token = strtok_r(slpService->attributes, ",", &track);
 				while (token != NULL) {
 					char *track2;
-					char *token2 = apr_strtok(token, "=", &track2);
-					char *token3 = apr_strtok(NULL, "=", &track2);
+					char *token2 = strtok_r(token, "=", &track2);
+					char *token3 = strtok_r(NULL, "=", &track2);
 					char *key = apr_pstrdup(discovery->pool, token2+1);
 					char *value = apr_pstrndup(discovery->pool, token3, strlen(token3) - 1);
 					properties_set(props, key, value);
-					token = apr_strtok(NULL, ",", &track);
+					token = strtok_r(NULL, ",", &track);
 				}
 
 				endpoint_description_pt endpoint = apr_palloc(discovery->pool, sizeof(*endpoint));

Modified: celix/trunk/shell_bonjour/private/src/activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/shell_bonjour/private/src/activator.c?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/shell_bonjour/private/src/activator.c (original)
+++ celix/trunk/shell_bonjour/private/src/activator.c Thu Jan 29 19:28:23 2015
@@ -27,7 +27,6 @@
 #include <celix_errno.h>
 
 #include <stdlib.h>
-#include <apr_strings.h>
 #include <apr_pools.h>
 
 #include "bundle_activator.h"

Modified: celix/trunk/utils/private/test/array_list_test.c
URL: http://svn.apache.org/viewvc/celix/trunk/utils/private/test/array_list_test.c?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/utils/private/test/array_list_test.c (original)
+++ celix/trunk/utils/private/test/array_list_test.c Thu Jan 29 19:28:23 2015
@@ -27,19 +27,14 @@
 #include <stdlib.h>
 #include <CUnit/Automated.h>
 
-#include <apr_general.h>
-
 #include "celixbool.h"
 
 #include "array_list.h"
 #include "array_list_private.h"
 
-apr_pool_t *memory_pool;
 array_list_pt list;
 
 int setup(void) {
-	apr_initialize();
-	apr_pool_create(&memory_pool, NULL);
 	arrayList_create(&list);
 	if (list == NULL) {
 		return 1;

Modified: celix/trunk/utils/private/test/linked_list_test.c
URL: http://svn.apache.org/viewvc/celix/trunk/utils/private/test/linked_list_test.c?rev=1655824&r1=1655823&r2=1655824&view=diff
==============================================================================
--- celix/trunk/utils/private/test/linked_list_test.c (original)
+++ celix/trunk/utils/private/test/linked_list_test.c Thu Jan 29 19:28:23 2015
@@ -24,7 +24,6 @@
  *  \copyright	Apache License, Version 2.0
  */
 #include <stdio.h>
-#include <apr_pools.h>
 #include <stddef.h>
 
 #include <CUnit/Automated.h>



Mime
View raw message