about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-11-08 19:06:39 +0100
committerLeah Neukirchen <leah@vuxu.org>2017-11-08 19:06:39 +0100
commit8eb0b62952061ffefb28b06e2e5c7a58c5a1f364 (patch)
treefff2b65b00a1610784781ce8630e57098836fd4b
parentc9c4a157d34cc18041890dc54afd040fadb441da (diff)
downloadlr-8eb0b62952061ffefb28b06e2e5c7a58c5a1f364.tar.gz
lr-8eb0b62952061ffefb28b06e2e5c7a58c5a1f364.tar.xz
lr-8eb0b62952061ffefb28b06e2e5c7a58c5a1f364.zip
replace GNU-extension tdestroy(3) with something portable
-rw-r--r--lr.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lr.c b/lr.c
index 459f012..f89dec1 100644
--- a/lr.c
+++ b/lr.c
@@ -2080,9 +2080,13 @@ tree_recurse(const void *nodep, const VISIT which, const int depth)
 }
 
 void
-tree_free(void *nodep)
+tree_free()
 {
-	free_fi(nodep);
+	while (root) {
+		struct fileinfo *fi = *(struct fileinfo **)root;
+		tdelete(fi, &root, order);
+		free_fi(fi);
+	}
 }
 
 int
@@ -2267,7 +2271,7 @@ main(int argc, char *argv[])
 		while (root) {
 			twalk(root, tree_print);
 			twalk(root, tree_recurse);
-			tdestroy(root, tree_free);
+			tree_free();
 
 			root = new_root;
 			new_root = 0;