diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-02-17 09:16:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-02-17 09:16:48 +0400 |
commit | 34805a4752b0ce6a66d24389b04f86b26fb7e71f (patch) | |
tree | ce2bf9e5b011a0b61f8a8f6c5980408e2558ea24 /source | |
parent | 00f48914f32f9df4266ff73550a0f80a085baa32 (diff) |
BLI_mempool totalloc was being used un-initialized, normally this would cause bugs but turns out its not used,
ifdef'd it out but keep in the struct in BLI_mempool for now.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/intern/BLI_mempool.c | 14 | ||||
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index 7670b057a7f..5f0c90f234d 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -54,6 +54,9 @@ #define FREEWORD MAKE_ID('f', 'r', 'e', 'e') +/* currently totalloc isnt used */ +// #define USE_TOTALLOC + typedef struct BLI_freenode { struct BLI_freenode *next; int freeword; /* used to identify this as a freed node */ @@ -110,6 +113,7 @@ BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag) pool->pchunk = pchunk; pool->csize = esize * pchunk; pool->chunks.first = pool->chunks.last = NULL; + pool->totalloc = 0; pool->totused = 0; maxchunks = totelem / pchunk + 1; @@ -159,10 +163,11 @@ BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag) } } - /* set the end of this chunks memoryy to the new tail for next iteration */ + /* set the end of this chunks memory to the new tail for next iteration */ lasttail = curnode; - +#ifdef USE_TOTALLOC pool->totalloc += pool->pchunk; +#endif } /* terminate the list */ curnode->next = NULL; @@ -213,8 +218,9 @@ void *BLI_mempool_alloc(BLI_mempool *pool) } } curnode->next = NULL; /* terminate the list */ - +#ifdef USE_TOTALLOC pool->totalloc += pool->pchunk; +#endif } retval = pool->free; @@ -282,7 +288,9 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr) } BLI_addtail(&pool->chunks, first); +#ifdef USE_TOTALLOC pool->totalloc = pool->pchunk; +#endif pool->free = first->data; /* start of the list */ for (tmpaddr = first->data, i = 0; i < pool->pchunk; i++) { diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 96ca3805d3e..95222a067af 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1798,7 +1798,7 @@ static const char *rna_parameter_type_cpp_name(PropertyRNA *prop) } } -static void rna_def_struct_function_prototype_cpp(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc, +static void rna_def_struct_function_prototype_cpp(FILE *f, StructRNA *UNUSED(srna), FunctionDefRNA *dfunc, const char *namespace, int close_prototype) { PropertyDefRNA *dp; |