src/ucx/list.c

changeset 135
471e28cca288
parent 99
b9a6af0ae41a
child 254
4784c14aa639
--- a/src/ucx/list.c	Tue Dec 27 17:54:00 2016 +0100
+++ b/src/ucx/list.c	Tue Dec 27 18:42:36 2016 +0100
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright 2015 Olaf Wintermann. All rights reserved.
+ * Copyright 2016 Olaf Wintermann. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -76,6 +76,13 @@
     }
 }
 
+void ucx_list_free_content(UcxList* list, ucx_destructor destr) {
+    while (list != NULL) {
+        destr(list->data);
+        list = list->next;
+    }
+}
+
 UcxList *ucx_list_append(UcxList *l, void *data)  {
     return ucx_list_append_a(ucx_default_allocator(), l, data);
 }

mercurial