summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/fstree/fstree_from_dir.c6
-rw-r--r--lib/fstree/internal.h2
-rw-r--r--lib/fstree/mknode.c6
3 files changed, 7 insertions, 7 deletions
diff --git a/lib/fstree/fstree_from_dir.c b/lib/fstree/fstree_from_dir.c
index e0ea600..a11f383 100644
--- a/lib/fstree/fstree_from_dir.c
+++ b/lib/fstree/fstree_from_dir.c
@@ -5,7 +5,7 @@
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
#include "config.h"
-#include "fstree.h"
+#include "internal.h"
#include <dirent.h>
#include <stdlib.h>
@@ -98,9 +98,7 @@ static int add_node(fstree_t *fs, tree_node_t *root,
n->mod_time = fs->defaults.st_mtime;
}
- n->parent = root;
- n->next = root->data.dir.children;
- root->data.dir.children = n;
+ fstree_insert_sorted(root, n);
return 0;
}
diff --git a/lib/fstree/internal.h b/lib/fstree/internal.h
index c594f64..d14fb4f 100644
--- a/lib/fstree/internal.h
+++ b/lib/fstree/internal.h
@@ -17,4 +17,6 @@
*/
sqfs_u32 get_source_date_epoch(void);
+void fstree_insert_sorted(tree_node_t *root, tree_node_t *n);
+
#endif /* FSTREE_INTERNAL_H */
diff --git a/lib/fstree/mknode.c b/lib/fstree/mknode.c
index 75fa46a..7d6e315 100644
--- a/lib/fstree/mknode.c
+++ b/lib/fstree/mknode.c
@@ -6,13 +6,13 @@
*/
#include "config.h"
-#include "fstree.h"
+#include "internal.h"
#include <string.h>
#include <stdlib.h>
#include <errno.h>
-static void insert_sorted(tree_node_t *root, tree_node_t *n)
+void fstree_insert_sorted(tree_node_t *root, tree_node_t *n)
{
tree_node_t *it = root->data.dir.children, *prev = NULL;
@@ -88,7 +88,7 @@ tree_node_t *fstree_mknode(tree_node_t *parent, const char *name,
}
if (parent != NULL) {
- insert_sorted(parent, n);
+ fstree_insert_sorted(parent, n);
if (parent->link_count == 0x0FFFF) {
free(n);