]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
skiplist_destroy() is new-ish
authorJim Jagielski <jim@apache.org>
Mon, 19 Nov 2012 16:28:13 +0000 (16:28 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 19 Nov 2012 16:28:13 +0000 (16:28 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1411279 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/eventopt/skiplist.c
server/mpm/eventopt/skiplist.h

index 26ace19d75ff5692b36579b8775fc855be5c2754..39a927f9cb88904acbc45930dd0f5678bd687099 100644 (file)
@@ -663,6 +663,19 @@ void *skiplist_peek(Skiplist *a)
     return data;
 }
 
+static void skiplisti_destroy(void *vsl)
+{
+    skiplist_destroy((Skiplist *) vsl, NULL);
+    skiplist_free((Skiplist *) vsl, vsl);
+}
+
+void skiplist_destroy(Skiplist *sl, FreeFunc myfree)
+{
+    while (skiplist_pop(sl->index, skiplisti_destroy) != NULL)
+        ;
+    skiplist_remove_all(sl, myfree);
+}
+
 Skiplist *skiplist_merge(Skiplist *sl1, Skiplist *sl2)
 {
     /* Check integrity! */
index 50543acb4104d315cbb1574aad22c93dd688ee4c..42447c7283de8acafb0eee121c0125e628bc6720 100644 (file)
@@ -98,6 +98,8 @@ int skiplisti_remove(Skiplist *sl, skiplistnode *m, FreeFunc myfree);
 
 void skiplist_remove_all(Skiplist *sl, FreeFunc myfree);
 
+void skiplist_destroy(Skiplist *sl, FreeFunc myfree);
+
 #if 0
 int skiplisti_find_compare(Skiplist *sl,
                            void *data,