From ad9b91996209f76bb3658afeba426ecd3e8243e7 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 18 Feb 2020 14:37:42 +0100 Subject: Cleanup: protect parameters of `FOREACH_MAIN_ID` & co macros. --- source/blender/blenkernel/BKE_main.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to '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; \ -- cgit v1.2.3