[Bf-blender-cvs] [c3a3664] master: Utility macros for linklist stack & asserts for bmesh

Campbell Barton noreply at git.blender.org
Sat May 10 01:30:12 CEST 2014


Commit: c3a3664e8c7b196091a786251293012002735b91
Author: Campbell Barton
Date:   Sat May 10 08:46:35 2014 +1000
https://developer.blender.org/rBc3a3664e8c7b196091a786251293012002735b91

Utility macros for linklist stack & asserts for bmesh

===================================================================

M	source/blender/blenlib/BLI_linklist_stack.h
M	source/blender/bmesh/intern/bmesh_core.c

===================================================================

diff --git a/source/blender/blenlib/BLI_linklist_stack.h b/source/blender/blenlib/BLI_linklist_stack.h
index 1933dd7..5f4f98c 100644
--- a/source/blender/blenlib/BLI_linklist_stack.h
+++ b/source/blender/blenlib/BLI_linklist_stack.h
@@ -155,6 +155,13 @@
 	(_BLI_SMALLSTACK_CAST(var_src) ((_##var_src##_stack) ? \
 	(_BLI_SMALLSTACK_DEL_EX(var_src, var_dst), (_##var_dst##_free->link)) : NULL))
 
+#define BLI_SMALLSTACK_LAST(var) \
+	(_BLI_SMALLSTACK_CAST(var) ((_##var##_stack) ? \
+	                             _##var##_stack->link : NULL))
+
+#define BLI_SMALLSTACK_IS_EMPTY(var) \
+	(_BLI_SMALLSTACK_CAST(var) (_##var##_stack != NULL))
+
 /* loop over stack members last-added-first */
 #define BLI_SMALLSTACK_ITER_BEGIN(var, item) \
 	{ \
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index 4c70305..1f81b59 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -132,7 +132,10 @@ BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2,
                        const BMEdge *e_example, const eBMCreateFlag create_flag)
 {
 	BMEdge *e;
-	
+
+	BLI_assert(v1 != v2);
+	BLI_assert(v1->head.htype == BM_VERT && v2->head.htype == BM_VERT);
+
 	if ((create_flag & BM_CREATE_NO_DOUBLE) && (e = BM_edge_exists(v1, v2)))
 		return e;




More information about the Bf-blender-cvs mailing list