celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1620919 - /celix/trunk/remote_services/discovery_configured/private/src/endpoint_descriptor_reader.c
Date Wed, 27 Aug 2014 15:55:35 GMT
Author: abroekhuis
Date: Wed Aug 27 15:55:34 2014
New Revision: 1620919

URL: http://svn.apache.org/r1620919
Log:
Update string assignment to make the string empty.

Modified:
    celix/trunk/remote_services/discovery_configured/private/src/endpoint_descriptor_reader.c

Modified: celix/trunk/remote_services/discovery_configured/private/src/endpoint_descriptor_reader.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_configured/private/src/endpoint_descriptor_reader.c?rev=1620919&r1=1620918&r2=1620919&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_configured/private/src/endpoint_descriptor_reader.c
(original)
+++ celix/trunk/remote_services/discovery_configured/private/src/endpoint_descriptor_reader.c
Wed Aug 27 15:55:34 2014
@@ -67,21 +67,18 @@ void endpointDescriptorReader_addSingleV
 }
 
 void endpointDescriptorReader_addMultiValuedProperty(properties_pt properties, const xmlChar*
name, array_list_pt values) {
-	char *value = malloc(256);
-	if (value) {
-		int i, size = arrayList_size(values);
-		for (i = 0; i < size; i++) {
-			char* item = (char*) arrayList_get(values, i);
-			if (i > 0) {
-				value = strcat(value, ",");
-			}
-			value = strcat(value, item);
-		}
-
-		properties_set(properties, strdup((char *) name), strdup(value));
+	char value[256];
+	value[0] = '\0';
+    int i, size = arrayList_size(values);
+    for (i = 0; i < size; i++) {
+        char* item = (char*) arrayList_get(values, i);
+        if (i > 0) {
+            strcat(value, ",");
+        }
+        strcat(value, item);
+    }
 
-		free(value);
-	}
+    properties_set(properties, strdup((char *) name), strdup(value));
 }
 
 celix_status_t endpointDescriptorReader_parseDocument(endpoint_descriptor_reader_pt reader,
char *document, array_list_pt *endpoints) {



Mime
View raw message