summaryrefslogtreecommitdiff
path: root/lib/fstree
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-16 19:52:42 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-18 22:44:39 +0200
commitb45850388ea5505f4fd50cd659abe2f02aeca0b5 (patch)
tree994f878caf990d1569831762f0b0f4d787ab9839 /lib/fstree
parent1a95478b8d340c8b6b9dbff4f38f9293388fd1a3 (diff)
cleanup: internalize deduplication list in data_writer
This change removes the need for passing a list of files around for deduplication. Also the deduplication code no longer needs to worry about order, since the file being deduplicated is only added after deduplication is done. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/fstree')
-rw-r--r--lib/fstree/deduplicate.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/fstree/deduplicate.c b/lib/fstree/deduplicate.c
index 7390a2c..00815a6 100644
--- a/lib/fstree/deduplicate.c
+++ b/lib/fstree/deduplicate.c
@@ -16,10 +16,8 @@ file_info_t *fragment_by_chksum(file_info_t *fi, uint32_t chksum,
file_info_t *it;
for (it = list; it != NULL; it = it->next) {
- if (it == fi) {
- it = NULL;
- break;
- }
+ if (it == fi)
+ continue;
if (!(it->flags & FILE_FLAG_HAS_FRAGMENT))
continue;
@@ -82,10 +80,8 @@ uint64_t find_equal_blocks(file_info_t *file, file_info_t *list,
}
for (it = list; it != NULL; it = it->next) {
- if (it == file) {
- it = NULL;
- break;
- }
+ if (it == file)
+ continue;
if (it->flags & FILE_FLAG_BLOCKS_ARE_DUPLICATE)
continue;