[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54215] trunk/blender/source/blender/ blenlib/intern/BLI_mempool.c: add BLI_mempool_as_arrayN utility function for getting the mempool as a new array (utility function currently unused).
Campbell Barton
ideasman42 at gmail.com
Wed Jan 30 22:17:12 CET 2013
Revision: 54215
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54215
Author: campbellbarton
Date: 2013-01-30 21:17:09 +0000 (Wed, 30 Jan 2013)
Log Message:
-----------
add BLI_mempool_as_arrayN utility function for getting the mempool as a new array (utility function currently unused).
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-30 18:43:28 UTC (rev 54214)
+++ trunk/blender/source/blender/blenlib/intern/BLI_mempool.c 2013-01-30 21:17:09 UTC (rev 54215)
@@ -235,7 +235,11 @@
return retval;
}
-/* doesnt protect against double frees, don't be stupid! */
+/**
+ * Free an element from the mempool.
+ *
+ * \note doesnt protect against double frees, don't be stupid!
+ */
void BLI_mempool_free(BLI_mempool *pool, void *addr)
{
BLI_freenode *newhead = addr;
@@ -325,6 +329,16 @@
BLI_assert((p - data) == pool->totused);
}
+/**
+ * Allocate an array from the mempool.
+ */
+void *BLI_mempool_as_arrayN(BLI_mempool *pool, const char *allocstr)
+{
+ void *data = MEM_mallocN(BLI_mempool_count(pool) * pool->esize, allocstr);
+ BLI_mempool_as_array(pool, data);
+ return data;
+}
+
void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter)
{
BLI_assert(pool->flag & BLI_MEMPOOL_ALLOW_ITER);
@@ -397,6 +411,9 @@
#endif
+/**
+ * Free the mempool its self (and all elements).
+ */
void BLI_mempool_destroy(BLI_mempool *pool)
{
BLI_mempool_chunk *mpchunk = NULL;
More information about the Bf-blender-cvs
mailing list