Revision: 53906
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53906
Author:   campbellbarton
Date:     2013-01-19 03:16:52 +0000 (Sat, 19 Jan 2013)
Log Message:
-----------
replace error prints with asserts in BLI_mempool when an iterator function is 
called on a non-iterator flagged pool.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/BLI_mempool.c

Modified: trunk/blender/source/blender/blenlib/intern/BLI_mempool.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_mempool.c   2013-01-19 
03:04:51 UTC (rev 53905)
+++ trunk/blender/source/blender/blenlib/intern/BLI_mempool.c   2013-01-19 
03:16:52 UTC (rev 53906)
@@ -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 @@
 
 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,14 +311,8 @@
 
 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;
+       BLI_assert(pool->flag & BLI_MEMPOOL_ALLOW_ITER);
 
-               return;
-       }
-
        iter->pool = pool;
        iter->curchunk = pool->chunks.first;
        iter->curindex = 0;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to