[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54605] trunk/blender/source/blender: BLI_mempool totalloc was being used un-initialized, normally this would cause bugs but turns out its not used,

Campbell Barton ideasman42 at gmail.com
Sun Feb 17 06:16:49 CET 2013


Revision: 54605
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54605
Author:   campbellbarton
Date:     2013-02-17 05:16:48 +0000 (Sun, 17 Feb 2013)
Log Message:
-----------
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.

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

Modified: trunk/blender/source/blender/blenlib/intern/BLI_mempool.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_mempool.c	2013-02-17 04:35:50 UTC (rev 54604)
+++ trunk/blender/source/blender/blenlib/intern/BLI_mempool.c	2013-02-17 05:16:48 UTC (rev 54605)
@@ -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 @@
 	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 @@
 			}
 		}
 
-		/* 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 @@
 			}
 		}
 		curnode->next = NULL; /* terminate the list */
-
+#ifdef USE_TOTALLOC
 		pool->totalloc += pool->pchunk;
+#endif
 	}
 
 	retval = pool->free;
@@ -282,7 +288,9 @@
 		}
 
 		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++) {

Modified: trunk/blender/source/blender/makesrna/intern/makesrna.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/makesrna.c	2013-02-17 04:35:50 UTC (rev 54604)
+++ trunk/blender/source/blender/makesrna/intern/makesrna.c	2013-02-17 05:16:48 UTC (rev 54605)
@@ -1798,7 +1798,7 @@
 	}
 }
 
-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;




More information about the Bf-blender-cvs mailing list