Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-01-19 07:16:52 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-01-19 07:16:52 +0400
commitbf355362b11b3aaad50f2de881d67bad0209f51e (patch)
tree7be6f4e8b6f9d8cab4b8814da3ca06d62a77e312 /source/blender/blenlib/intern/BLI_mempool.c
parent53e383ff9da3636db5b1b6288ba7aea0dfaf5393 (diff)
replace error prints with asserts in BLI_mempool when an iterator function is called on a non-iterator flagged pool.
Diffstat (limited to 'source/blender/blenlib/intern/BLI_mempool.c')
-rw-r--r--source/blender/blenlib/intern/BLI_mempool.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c
index d98e63d88dd..501c12e9207 100644
--- a/source/blender/blenlib/intern/BLI_mempool.c
+++ b/source/blender/blenlib/intern/BLI_mempool.c
@@ -27,9 +27,7 @@
/** \file blender/blenlib/intern/BLI_mempool.c
* \ingroup bli
- */
-
-/*
+ *
* Simple, fast memory allocator for allocating many elements of the same size.
*/
@@ -295,11 +293,9 @@ int BLI_mempool_count(BLI_mempool *pool)
void *BLI_mempool_findelem(BLI_mempool *pool, int index)
{
- if (!(pool->flag & BLI_MEMPOOL_ALLOW_ITER)) {
- fprintf(stderr, "%s: Error! you can't iterate over this mempool!\n", __func__);
- return NULL;
- }
- else if ((index >= 0) && (index < pool->totused)) {
+ BLI_assert(pool->flag & BLI_MEMPOOL_ALLOW_ITER);
+
+ if ((index >= 0) && (index < pool->totused)) {
/* we could have some faster mem chunk stepping code inline */
BLI_mempool_iter iter;
void *elem;
@@ -315,13 +311,7 @@ void *BLI_mempool_findelem(BLI_mempool *pool, int index)
void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter)
{
- if (!(pool->flag & BLI_MEMPOOL_ALLOW_ITER)) {
- fprintf(stderr, "%s: Error! you can't iterate over this mempool!\n", __func__);
- iter->curchunk = NULL;
- iter->curindex = 0;
-
- return;
- }
+ BLI_assert(pool->flag & BLI_MEMPOOL_ALLOW_ITER);
iter->pool = pool;
iter->curchunk = pool->chunks.first;