aboutsummaryrefslogtreecommitdiff
path: root/lib/fstree/src/add_by_path.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-04-19 08:51:26 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-04-19 11:17:51 +0200
commit75fb524b5702bca4f8467309f7d95f9937ec6683 (patch)
treeb47a037c0f24873a9fc5b3f5b08583c9ad90de08 /lib/fstree/src/add_by_path.c
parenta13df03fddd9499960d4653aaee0970983b65f73 (diff)
libfstree: get rid of dir_info_t
The single boolean created_implicitly can be replaced with a general purpose flag field. The "children" pointer can then be hoisted directly into the data union of tree_node_t. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/fstree/src/add_by_path.c')
-rw-r--r--lib/fstree/src/add_by_path.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/fstree/src/add_by_path.c b/lib/fstree/src/add_by_path.c
index 0afd898..344b586 100644
--- a/lib/fstree/src/add_by_path.c
+++ b/lib/fstree/src/add_by_path.c
@@ -31,13 +31,13 @@ tree_node_t *fstree_add_generic(fstree_t *fs, const char *path,
name = strrchr(path, '/');
name = (name == NULL ? path : (name + 1));
- child = parent->data.dir.children;
+ child = parent->data.children;
while (child != NULL && strcmp(child->name, name) != 0)
child = child->next;
out:
if (child != NULL) {
if (!S_ISDIR(child->mode) || !S_ISDIR(sb->st_mode) ||
- !child->data.dir.created_implicitly) {
+ !(child->flags & FLAG_DIR_CREATED_IMPLICITLY)) {
errno = EEXIST;
return NULL;
}
@@ -46,7 +46,7 @@ out:
child->gid = sb->st_gid;
child->mode = sb->st_mode;
child->mod_time = sb->st_mtime;
- child->data.dir.created_implicitly = false;
+ child->flags &= ~FLAG_DIR_CREATED_IMPLICITLY;
return child;
}