From 8e46cf637c86a257310e9df4fcf5912dd9fbbf57 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 31 Aug 2013 02:12:31 +0000 Subject: tweak mempool loop comparisons when we know there is no chance for skipping past the last value. also correct typo. --- source/blender/blenlib/intern/BLI_mempool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/blenlib/intern/BLI_mempool.c') diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index a6468e21c0d..a4cb335b778 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -177,7 +177,7 @@ static BLI_freenode *mempool_chunk_add(BLI_mempool *pool, BLI_mempool_chunk *mpc } /* loop through the allocated data, building the pointer structures */ - for (addr = CHUNK_DATA(mpchunk), j = 0; j <= pchunk_last; j++) { + for (addr = CHUNK_DATA(mpchunk), j = 0; j != pchunk_last; j++) { curnode = ((BLI_freenode *)addr); addr += pool->esize; curnode->next = (BLI_freenode *)addr; @@ -478,7 +478,7 @@ static void *bli_mempool_iternext(BLI_mempool_iter *iter) iter->curindex++; - if (iter->curindex >= iter->pool->pchunk) { + if (iter->curindex == iter->pool->pchunk) { iter->curchunk = iter->curchunk->next; iter->curindex = 0; } @@ -516,7 +516,7 @@ void *BLI_mempool_iterstep(BLI_mempool_iter *iter) return NULL; } - if (UNLIKELY(++iter->curindex >= iter->pool->pchunk)) { + if (UNLIKELY(++iter->curindex == iter->pool->pchunk)) { iter->curindex = 0; iter->curchunk = iter->curchunk->next; } -- cgit v1.2.3