From 982db0d8d6fdc32d605f716bd891b5bbc4838608 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 19 Apr 2023 09:44:35 +0200 Subject: libfstree: Change file_info_t already_matched into flag Signed-off-by: David Oberhollenzer --- bin/gensquashfs/src/sort_by_file.c | 10 ++++++---- include/fstree.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/gensquashfs/src/sort_by_file.c b/bin/gensquashfs/src/sort_by_file.c index bc89c39..6a428ab 100644 --- a/bin/gensquashfs/src/sort_by_file.c +++ b/bin/gensquashfs/src/sort_by_file.c @@ -257,9 +257,11 @@ int fstree_sort_files(fstree_t *fs, istream_t *sortfile) file_info_t *it; for (it = fs->files; it != NULL; it = it->next) { + tree_node_t *node = container_of(it, tree_node_t, data.file); + it->priority = 0; it->flags = 0; - it->already_matched = false; + node->flags &= ~FLAG_FILE_ALREADY_MATCHED; } filename = istream_get_filename(sortfile); @@ -308,10 +310,10 @@ int fstree_sort_files(fstree_t *fs, istream_t *sortfile) tree_node_t *node; char *path; - if (it->already_matched) + node = container_of(it, tree_node_t, data.file); + if (node->flags & FLAG_FILE_ALREADY_MATCHED) continue; - node = container_of(it, tree_node_t, data.file); path = fstree_get_path(node); if (path == NULL) { fprintf(stderr, "%s: " PRI_SZ ": out-of-memory\n", @@ -344,7 +346,7 @@ int fstree_sort_files(fstree_t *fs, istream_t *sortfile) have_match = true; it->flags = flags; it->priority = priority; - it->already_matched = true; + node->flags |= FLAG_FILE_ALREADY_MATCHED; if (!do_glob) break; diff --git a/include/fstree.h b/include/fstree.h index 7f85be8..1a7ad30 100644 --- a/include/fstree.h +++ b/include/fstree.h @@ -31,6 +31,7 @@ typedef struct fstree_t fstree_t; enum { FLAG_DIR_CREATED_IMPLICITLY = 0x01, + FLAG_FILE_ALREADY_MATCHED = 0x02, }; /* Additional meta data stored in a tree_node_t for regular files. */ @@ -46,7 +47,6 @@ struct file_info_t { /* used by sort file processing */ sqfs_s64 priority; int flags; - bool already_matched; }; /* A node in a file system tree */ -- cgit v1.2.3