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:
authorDaniel Dunbar <daniel@zuster.org>2005-03-21 03:48:19 +0300
committerDaniel Dunbar <daniel@zuster.org>2005-03-21 03:48:19 +0300
commit6e41cb0a97ff7a39f601f1c6c34d94fef3aed459 (patch)
treeba710de1f3b729ac67f13abeaac25185cf1c7eca /source/blender/blenlib/intern/BLI_memarena.c
parent99676b7bfb7a481d2222a848ada661167842565f (diff)
- switch BLI_memarena to use stdlib malloc/free (alloc errors
will be caught by containing structure) - fixed off-by-one bug (reallocated one byte before necessary)
Diffstat (limited to 'source/blender/blenlib/intern/BLI_memarena.c')
-rw-r--r--source/blender/blenlib/intern/BLI_memarena.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/BLI_memarena.c b/source/blender/blenlib/intern/BLI_memarena.c
index 39f36c88ff6..f81cbfbe6c4 100644
--- a/source/blender/blenlib/intern/BLI_memarena.c
+++ b/source/blender/blenlib/intern/BLI_memarena.c
@@ -31,6 +31,8 @@
* Efficient memory allocation for lots of similar small chunks.
*/
+#include <stdlib.h>
+
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
@@ -55,7 +57,7 @@ MemArena *BLI_memarena_new(int bufsize) {
return ma;
}
void BLI_memarena_free(MemArena *ma) {
- BLI_linklist_free(ma->bufs, (void(*)(void*)) MEM_freeN);
+ BLI_linklist_free(ma->bufs, (void(*)(void*)) free);
MEM_freeN(ma);
}
@@ -69,9 +71,9 @@ void *BLI_memarena_alloc(MemArena *ma, int size) {
* size up to multiple of 8 */
size= PADUP(size, 8);
- if (size>=ma->cursize) {
+ if (size>ma->cursize) {
ma->cursize= (size>ma->bufsize)?size:ma->bufsize;
- ma->curbuf= MEM_mallocN(ma->cursize, "ma->curbuf");
+ ma->curbuf= malloc(ma->cursize);
BLI_linklist_prepend(&ma->bufs, ma->curbuf);
}