Correct IS_EMPTY macro
authorCampbell Barton <ideasman42@gmail.com>
Tue, 8 Jul 2014 21:52:06 +0000 (07:52 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 8 Jul 2014 21:53:43 +0000 (07:53 +1000)
also prevent reading from BM_ELEM_API_FLAG_ get/setters

source/blender/blenlib/BLI_linklist_stack.h
source/blender/bmesh/intern/bmesh_private.h

index d3d1924628c1358261f1525aabffb6d057c1923e..84e7130a9620527815d1b895fd147fa0cda8be77 100644 (file)
                                     _##var##_stack->link : NULL))
 
 #define BLI_SMALLSTACK_IS_EMPTY(var) \
-       (_BLI_SMALLSTACK_CAST(var) (_##var##_stack != NULL))
+       ((_BLI_SMALLSTACK_CAST(var) _##var##_stack) == NULL)
 
 /* loop over stack members last-added-first */
 #define BLI_SMALLSTACK_ITER_BEGIN(var, item) \
index cac4713c8b229e4a7ab613c43fb4af2b227b3fa4..731c36437d54552130421321ee4edc18e558d802 100644 (file)
@@ -67,10 +67,10 @@ enum {
        _FLAG_OVERLAP  = (1 << 2)   /* general overlap flag  */
 };
 
-#define BM_ELEM_API_FLAG_ENABLE(element, f)  ((element)->head.api_flag |=  (f))
-#define BM_ELEM_API_FLAG_DISABLE(element, f) ((element)->head.api_flag &= ~(f))
-#define BM_ELEM_API_FLAG_TEST(element, f)    ((element)->head.api_flag &   (f))
-#define BM_ELEM_API_FLAG_CLEAR(element)      ((element)->head.api_flag = 0)
+#define BM_ELEM_API_FLAG_ENABLE(element, f)  { ((element)->head.api_flag |=  (f)); } (void)0
+#define BM_ELEM_API_FLAG_DISABLE(element, f) { ((element)->head.api_flag &= ~(f)); } (void)0
+#define BM_ELEM_API_FLAG_TEST(element, f)      ((element)->head.api_flag &   (f))
+#define BM_ELEM_API_FLAG_CLEAR(element)      { ((element)->head.api_flag = 0); } (void)0
 
 void poly_rotate_plane(const float normal[3], float (*verts)[3], unsigned const int nverts);