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));