From ea8ed35e8665be75923bb483c377421d24ae2faf Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 28 Apr 2023 00:50:31 +0200 Subject: gensquashfs: use stacked tree iterator in fstree_from_dir Signed-off-by: David Oberhollenzer --- lib/fstree/src/add_by_path.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lib/fstree') diff --git a/lib/fstree/src/add_by_path.c b/lib/fstree/src/add_by_path.c index 344b586..f204836 100644 --- a/lib/fstree/src/add_by_path.c +++ b/lib/fstree/src/add_by_path.c @@ -14,17 +14,24 @@ tree_node_t *fstree_add_generic(fstree_t *fs, const char *path, const struct stat *sb, const char *extra) +{ + return fstree_add_generic_at(fs, fs->root, path, sb, extra); +} + +tree_node_t *fstree_add_generic_at(fstree_t *fs, tree_node_t *root, + const char *path, const struct stat *sb, + const char *extra) { tree_node_t *child, *parent; const char *name; if (*path == '\0') { - child = fs->root; + child = root; assert(child != NULL); goto out; } - parent = fstree_get_node_by_path(fs, fs->root, path, true, true); + parent = fstree_get_node_by_path(fs, root, path, true, true); if (parent == NULL) return NULL; -- cgit v1.2.3