[Bf-blender-cvs] [ad9b9199620] master: Cleanup: protect parameters of `FOREACH_MAIN_ID` & co macros.

Bastien Montagne noreply at git.blender.org
Tue Feb 18 14:38:41 CET 2020


Commit: ad9b91996209f76bb3658afeba426ecd3e8243e7
Author: Bastien Montagne
Date:   Tue Feb 18 14:37:42 2020 +0100
Branches: master
https://developer.blender.org/rBad9b91996209f76bb3658afeba426ecd3e8243e7

Cleanup: protect parameters of `FOREACH_MAIN_ID` & co macros.

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

M	source/blender/blenkernel/BKE_main.h

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

diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h
index 8b46939c6d1..a263162e013 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -165,9 +165,9 @@ struct GSet *BKE_main_gset_create(struct Main *bmain, struct GSet *gset);
 
 #define FOREACH_MAIN_LISTBASE_ID_BEGIN(_lb, _id) \
   { \
-    ID *_id_next = _lb->first; \
-    for (_id = _id_next; _id != NULL; _id = _id_next) { \
-      _id_next = _id->next;
+    ID *_id_next = (_lb)->first; \
+    for ((_id) = _id_next; (_id) != NULL; (_id) = _id_next) { \
+      _id_next = (_id)->next;
 
 #define FOREACH_MAIN_LISTBASE_ID_END \
   } \
@@ -177,9 +177,9 @@ struct GSet *BKE_main_gset_create(struct Main *bmain, struct GSet *gset);
 #define FOREACH_MAIN_LISTBASE_BEGIN(_bmain, _lb) \
   { \
     ListBase *_lbarray[MAX_LIBARRAY]; \
-    int _i = set_listbasepointers(_bmain, _lbarray); \
+    int _i = set_listbasepointers((_bmain), _lbarray); \
     while (_i--) { \
-      _lb = _lbarray[_i];
+      (_lb) = _lbarray[_i];
 
 #define FOREACH_MAIN_LISTBASE_END \
   } \
@@ -193,8 +193,8 @@ struct GSet *BKE_main_gset_create(struct Main *bmain, struct GSet *gset);
 #define FOREACH_MAIN_ID_BEGIN(_bmain, _id) \
   { \
     ListBase *_lb; \
-    FOREACH_MAIN_LISTBASE_BEGIN (_bmain, _lb) { \
-      FOREACH_MAIN_LISTBASE_ID_BEGIN (_lb, _id)
+    FOREACH_MAIN_LISTBASE_BEGIN ((_bmain), _lb) { \
+      FOREACH_MAIN_LISTBASE_ID_BEGIN (_lb, (_id))
 
 #define FOREACH_MAIN_ID_END \
   FOREACH_MAIN_LISTBASE_ID_END; \



More information about the Bf-blender-cvs mailing list