[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59680] trunk/blender/source/blender: tweak mempool loop comparisons when we know there is no chance for skipping past the last value .

Campbell Barton ideasman42 at gmail.com
Sat Aug 31 04:12:32 CEST 2013


Revision: 59680
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59680
Author:   campbellbarton
Date:     2013-08-31 02:12:31 +0000 (Sat, 31 Aug 2013)
Log Message:
-----------
tweak mempool loop comparisons when we know there is no chance for skipping past the last value.
also correct typo.

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

Modified: trunk/blender/source/blender/blenlib/intern/BLI_mempool.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_mempool.c	2013-08-31 02:06:23 UTC (rev 59679)
+++ trunk/blender/source/blender/blenlib/intern/BLI_mempool.c	2013-08-31 02:12:31 UTC (rev 59680)
@@ -177,7 +177,7 @@
 	}
 
 	/* loop through the allocated data, building the pointer structures */
-	for (addr = CHUNK_DATA(mpchunk), j = 0; j <= pchunk_last; j++) {
+	for (addr = CHUNK_DATA(mpchunk), j = 0; j != pchunk_last; j++) {
 		curnode = ((BLI_freenode *)addr);
 		addr += pool->esize;
 		curnode->next = (BLI_freenode *)addr;
@@ -478,7 +478,7 @@
 
 	iter->curindex++;
 
-	if (iter->curindex >= iter->pool->pchunk) {
+	if (iter->curindex == iter->pool->pchunk) {
 		iter->curchunk = iter->curchunk->next;
 		iter->curindex = 0;
 	}
@@ -516,7 +516,7 @@
 			return NULL;
 		}
 
-		if (UNLIKELY(++iter->curindex >= iter->pool->pchunk)) {
+		if (UNLIKELY(++iter->curindex == iter->pool->pchunk)) {
 			iter->curindex = 0;
 			iter->curchunk = iter->curchunk->next;
 		}

Modified: trunk/blender/source/blender/python/mathutils/mathutils_geometry.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_geometry.c	2013-08-31 02:06:23 UTC (rev 59679)
+++ trunk/blender/source/blender/python/mathutils/mathutils_geometry.c	2013-08-31 02:12:31 UTC (rev 59680)
@@ -977,19 +977,19 @@
 );
 static PyObject *M_Geometry_distance_point_to_plane(PyObject *UNUSED(self), PyObject *args)
 {
-	VectorObject *pt, *plene_co, *plane_no;
+	VectorObject *pt, *plane_co, *plane_no;
 	float plane[4];
 
 	if (!PyArg_ParseTuple(args, "O!O!O!:distance_point_to_plane",
 	                      &vector_Type, &pt,
-	                      &vector_Type, &plene_co,
+	                      &vector_Type, &plane_co,
 	                      &vector_Type, &plane_no))
 	{
 		return NULL;
 	}
 
 	if (pt->size != 3 ||
-	    plene_co->size != 3 ||
+	    plane_co->size != 3 ||
 	    plane_no->size != 3)
 	{
 		PyErr_SetString(PyExc_ValueError,
@@ -998,13 +998,13 @@
 	}
 
 	if (BaseMath_ReadCallback(pt) == -1 ||
-	    BaseMath_ReadCallback(plene_co) == -1 ||
+	    BaseMath_ReadCallback(plane_co) == -1 ||
 	    BaseMath_ReadCallback(plane_no) == -1)
 	{
 		return NULL;
 	}
 
-	plane_from_point_normal_v3(plane, plene_co->vec, plane_no->vec);
+	plane_from_point_normal_v3(plane, plane_co->vec, plane_no->vec);
 	return PyFloat_FromDouble(dist_to_plane_v3(pt->vec, plane));
 }
 
@@ -1118,7 +1118,7 @@
 
 		/* python */
 		PyObject *py_verts = PyList_New(0);
-		PyObject *py_plene_index = PyList_New(0);
+		PyObject *py_plane_index = PyList_New(0);
 
 		memset(planes_used, 0, sizeof(char) * len);
 
@@ -1170,7 +1170,7 @@
 		for (i = 0; i < len; i++) {
 			if (planes_used[i]) {
 				PyObject *item = PyLong_FromLong(i);
-				PyList_Append(py_plene_index, item);
+				PyList_Append(py_plane_index, item);
 				Py_DECREF(item);
 			}
 		}
@@ -1179,7 +1179,7 @@
 		{
 			PyObject *ret = PyTuple_New(2);
 			PyTuple_SET_ITEM(ret, 0, py_verts);
-			PyTuple_SET_ITEM(ret, 1, py_plene_index);
+			PyTuple_SET_ITEM(ret, 1, py_plane_index);
 			return ret;
 		}
 	}




More information about the Bf-blender-cvs mailing list