diff options
-rw-r--r-- | source/blender/bmesh/intern/bmesh_core.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_private.h | 14 |
2 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index 4d10ef317f3..f03ce9b8543 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -340,6 +340,8 @@ BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len, return f; } +#ifndef NDEBUG + /** * Check the element is valid. * @@ -476,6 +478,8 @@ int bmesh_elem_check(void *element, const char htype) return err; } +#endif /* NDEBUG */ + /** * low level function, only frees the vert, * doesn't change or adjust surrounding geometry diff --git a/source/blender/bmesh/intern/bmesh_private.h b/source/blender/bmesh/intern/bmesh_private.h index 0827901f5c2..73370de8cee 100644 --- a/source/blender/bmesh/intern/bmesh_private.h +++ b/source/blender/bmesh/intern/bmesh_private.h @@ -37,15 +37,21 @@ */ /* returns positive nonzero on error */ -int bmesh_elem_check(void *element, const char htype); -#define BM_CHECK_ELEMENT(el) \ +#ifdef NDEBUG + /* no error checking for release, + * it can take most of the CPU time when running some tools */ +# define BM_CHECK_ELEMENT(el) (void)(el) +#else +int bmesh_elem_check(void *element, const char htype); +# define BM_CHECK_ELEMENT(el) \ if (bmesh_elem_check(el, ((BMHeader *)el)->htype)) { \ printf("check_element failure, with code %i on line %i in file\n" \ " \"%s\"\n\n", \ - bmesh_elem_check(el, ((BMHeader *)el)->htype), \ + bmesh_elem_check(el, ((BMHeader *)el)->htype), \ __LINE__, __FILE__); \ - } + } (void)0 +#endif #define BM_DISK_EDGE_LINK_GET(e, v) ( \ ((v) == ((BMEdge *)(e))->v1) ? \ |