From b6d493e8a78c4e90d73dbea1b5dd7a5c1e0dba2e Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 16 Jan 2024 13:36:43 -0500 Subject: [PATCH] Cleanup: Use LISTBASE_FOREACH file in memfile merge --- source/blender/blenloader/intern/undofile.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/source/blender/blenloader/intern/undofile.cc b/source/blender/blenloader/intern/undofile.cc index 4cfc214ac90..1cf23e38aa4 100644 --- a/source/blender/blenloader/intern/undofile.cc +++ b/source/blender/blenloader/intern/undofile.cc @@ -58,9 +58,7 @@ void BLO_memfile_merge(MemFile *first, MemFile *second) BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, __func__); /* First, detect all memchunks in second memfile that are not owned by it. */ - for (MemFileChunk *sc = static_cast(second->chunks.first); sc != nullptr; - sc = static_cast(sc->next)) - { + LISTBASE_FOREACH (MemFileChunk *, sc, &second->chunks) { if (sc->is_identical) { BLI_ghash_insert(buffer_to_second_memchunk, (void *)sc->buf, sc); } @@ -68,9 +66,7 @@ void BLO_memfile_merge(MemFile *first, MemFile *second) /* Now, check all chunks from first memfile (the one we are removing), and if a memchunk owned by * it is also used by the second memfile, transfer the ownership. */ - for (MemFileChunk *fc = static_cast(first->chunks.first); fc != nullptr; - fc = static_cast(fc->next)) - { + LISTBASE_FOREACH (MemFileChunk *, fc, &first->chunks) { if (!fc->is_identical) { MemFileChunk *sc = static_cast( BLI_ghash_lookup(buffer_to_second_memchunk, fc->buf));