diff --git a/src/system/kernel/cache/block_cache.cpp b/src/system/kernel/cache/block_cache.cpp index 6b14e5ff54..94fa4904bf 100644 --- a/src/system/kernel/cache/block_cache.cpp +++ b/src/system/kernel/cache/block_cache.cpp @@ -339,10 +339,8 @@ block_cache::RemoveUnusedBlocks(int32 maxAccessed, int32 count) { TRACE(("block_cache: remove up to %ld unused blocks\n", count)); - cached_block *next = NULL; - for (cached_block *block = unused_blocks.First(); block != NULL; - block = next) { - next = block->next; + for (block_list::Iterator it = unused_blocks.GetIterator(); + cached_block *block = it.Next();) { if (maxAccessed < block->accessed) continue; @@ -355,7 +353,7 @@ block_cache::RemoveUnusedBlocks(int32 maxAccessed, int32 count) write_cached_block(this, block, false); // remove block from lists - unused_blocks.Remove(block); + it.Remove(); hash_remove(hash, block); FreeBlock(block);