incubator-celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject svn commit: r1600097 - /incubator/celix/trunk/utils/private/src/linked_list.c
Date Wed, 04 Jun 2014 10:53:38 GMT
Author: pnoltes
Date: Wed Jun  4 10:53:38 2014
New Revision: 1600097

URL: http://svn.apache.org/r1600097
Log:
CELIX-119: added missing linkedList_destroy function

Modified:
    incubator/celix/trunk/utils/private/src/linked_list.c

Modified: incubator/celix/trunk/utils/private/src/linked_list.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/utils/private/src/linked_list.c?rev=1600097&r1=1600096&r2=1600097&view=diff
==============================================================================
--- incubator/celix/trunk/utils/private/src/linked_list.c (original)
+++ incubator/celix/trunk/utils/private/src/linked_list.c Wed Jun  4 10:53:38 2014
@@ -50,6 +50,27 @@ celix_status_t linkedList_create(linked_
 	return CELIX_ENOMEM;
 }
 
+UTILS_EXPORT celix_status_t linkedList_destroy(linked_list_pt list) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	linked_list_entry_pt current = NULL;
+	linked_list_entry_pt next = NULL;
+
+	current = list->header;
+	list->header = NULL;
+	list->size = 0;
+
+	while (current != NULL) {
+		next = current->next;
+		free(current);
+		current = next;
+	}
+
+	free(list);
+
+	return status;
+}
+
 celix_status_t linkedList_clone(linked_list_pt list, linked_list_pt *clone) {
 	celix_status_t status = CELIX_SUCCESS;
 



Mime
View raw message