diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-04-05 06:53:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-04-05 06:53:32 +0300 |
commit | 9fe0505db00f450333518238db6813ede046f45e (patch) | |
tree | f8d3feec11659a545aac2b419a223120dfafea1d /source/blender/editors | |
parent | 93806ba82b30683f3e459f0c77ea9b162e1287ec (diff) |
Cleanup: macro hygiene, parenthesize arguments
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/ED_anim_api.h | 19 | ||||
-rw-r--r-- | source/blender/editors/include/ED_armature.h | 2 | ||||
-rw-r--r-- | source/blender/editors/include/ED_keyframing.h | 6 | ||||
-rw-r--r-- | source/blender/editors/include/ED_screen.h | 2 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_intern.h | 3 | ||||
-rw-r--r-- | source/blender/editors/space_text/text_intern.h | 4 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.h | 8 |
7 files changed, 23 insertions, 21 deletions
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index fe249ce8bfe..a9b34e3c735 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -337,17 +337,17 @@ typedef enum eAnimFilter_Flags { /* 'Object' channels */ #define SEL_OBJC(base) (CHECK_TYPE_INLINE(base, Base *), ((base->flag & SELECT))) #define EXPANDED_OBJC(ob) \ - (CHECK_TYPE_INLINE(ob, Object *), ((ob->nlaflag & OB_ADS_COLLAPSED) == 0)) + (CHECK_TYPE_INLINE(ob, Object *), (((ob)->nlaflag & OB_ADS_COLLAPSED) == 0)) /* 'Sub-object' channels (flags stored in Data block) */ #define FILTER_SKE_OBJD(key) (CHECK_TYPE_INLINE(key, Key *), ((key->flag & KEY_DS_EXPAND))) #define FILTER_MAT_OBJD(ma) (CHECK_TYPE_INLINE(ma, Material *), ((ma->flag & MA_DS_EXPAND))) #define FILTER_LAM_OBJD(la) (CHECK_TYPE_INLINE(la, Light *), ((la->flag & LA_DS_EXPAND))) #define FILTER_CAM_OBJD(ca) (CHECK_TYPE_INLINE(ca, Camera *), ((ca->flag & CAM_DS_EXPAND))) #define FILTER_CACHEFILE_OBJD(cf) \ - (CHECK_TYPE_INLINE(cf, CacheFile *), ((cf->flag & CACHEFILE_DS_EXPAND))) + (CHECK_TYPE_INLINE(cf, CacheFile *), (((cf)->flag & CACHEFILE_DS_EXPAND))) #define FILTER_CUR_OBJD(cu) (CHECK_TYPE_INLINE(cu, Curve *), ((cu->flag & CU_DS_EXPAND))) #define FILTER_PART_OBJD(part) \ - (CHECK_TYPE_INLINE(part, ParticleSettings *), ((part->flag & PART_DS_EXPAND))) + (CHECK_TYPE_INLINE(part, ParticleSettings *), (((part)->flag & PART_DS_EXPAND))) #define FILTER_MBALL_OBJD(mb) (CHECK_TYPE_INLINE(mb, MetaBall *), ((mb->flag2 & MB_DS_EXPAND))) #define FILTER_ARM_OBJD(arm) (CHECK_TYPE_INLINE(arm, bArmature *), ((arm->flag & ARM_DS_EXPAND))) #define FILTER_MESH_OBJD(me) (CHECK_TYPE_INLINE(me, Mesh *), ((me->flag & ME_DS_EXPAND))) @@ -358,7 +358,7 @@ typedef enum eAnimFilter_Flags { #define FILTER_VOLUME_OBJD(vo) (CHECK_TYPE_INLINE(vo, Volume *), ((vo->flag & VO_DS_EXPAND))) /* Variable use expanders */ #define FILTER_NTREE_DATA(ntree) \ - (CHECK_TYPE_INLINE(ntree, bNodeTree *), ((ntree->flag & NTREE_DS_EXPAND))) + (CHECK_TYPE_INLINE(ntree, bNodeTree *), (((ntree)->flag & NTREE_DS_EXPAND))) #define FILTER_TEX_DATA(tex) (CHECK_TYPE_INLINE(tex, Tex *), ((tex->flag & TEX_DS_EXPAND))) /* 'Sub-object/Action' channels (flags stored in Action) */ @@ -369,11 +369,11 @@ typedef enum eAnimFilter_Flags { /* Actions (also used for Dopesheet) */ /* Action Channel Group */ -#define EDITABLE_AGRP(agrp) ((agrp->flag & AGRP_PROTECTED) == 0) +#define EDITABLE_AGRP(agrp) (((agrp)->flag & AGRP_PROTECTED) == 0) #define EXPANDED_AGRP(ac, agrp) \ - (((!(ac) || ((ac)->spacetype != SPACE_GRAPH)) && (agrp->flag & AGRP_EXPANDED)) || \ - (((ac) && ((ac)->spacetype == SPACE_GRAPH)) && (agrp->flag & AGRP_EXPANDED_G))) -#define SEL_AGRP(agrp) ((agrp->flag & AGRP_SELECTED) || (agrp->flag & AGRP_ACTIVE)) + (((!(ac) || ((ac)->spacetype != SPACE_GRAPH)) && ((agrp)->flag & AGRP_EXPANDED)) || \ + (((ac) && ((ac)->spacetype == SPACE_GRAPH)) && ((agrp)->flag & AGRP_EXPANDED_G))) +#define SEL_AGRP(agrp) (((agrp)->flag & AGRP_SELECTED) || ((agrp)->flag & AGRP_ACTIVE)) /* F-Curve Channels */ #define EDITABLE_FCU(fcu) ((fcu->flag & FCURVE_PROTECTED) == 0) #define SEL_FCU(fcu) (fcu->flag & FCURVE_SELECTED) @@ -433,7 +433,8 @@ typedef enum eAnimFilter_Flags { #define NLACHANNEL_FIRST_TOP(ac) \ (UI_view2d_scale_get_y(&(ac)->region->v2d) * -UI_TIME_SCRUB_MARGIN_Y - NLACHANNEL_SKIP) #define NLACHANNEL_HEIGHT(snla) \ - ((snla && (snla->flag & SNLA_NOSTRIPCURVES)) ? (0.8f * U.widget_unit) : (1.2f * U.widget_unit)) + (((snla) && ((snla)->flag & SNLA_NOSTRIPCURVES)) ? (0.8f * U.widget_unit) : \ + (1.2f * U.widget_unit)) #define NLACHANNEL_SKIP (0.1f * U.widget_unit) #define NLACHANNEL_STEP(snla) (NLACHANNEL_HEIGHT(snla) + NLACHANNEL_SKIP) /* Additional offset to give some room at the end. */ diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index 8e0103299eb..102c0dc0659 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -134,7 +134,7 @@ typedef struct EditBone { (((arm)->layer & (ebone)->layer) && !((ebone)->flag & BONE_HIDDEN_A))) #define EBONE_SELECTABLE(arm, ebone) \ - (EBONE_VISIBLE(arm, ebone) && !(ebone->flag & BONE_UNSELECTABLE)) + (EBONE_VISIBLE(arm, ebone) && !((ebone)->flag & BONE_UNSELECTABLE)) #define EBONE_EDITABLE(ebone) \ (CHECK_TYPE_INLINE(ebone, EditBone *), \ diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index b362d35c09a..4225ecc6f3d 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -430,14 +430,14 @@ void ANIM_copy_as_driver(struct ID *target_id, const char *target_path, const ch /* Auto-Keying macros for use by various tools */ /* check if auto-keyframing is enabled (per scene takes precedence) */ #define IS_AUTOKEY_ON(scene) \ - ((scene) ? (scene->toolsettings->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON)) + ((scene) ? ((scene)->toolsettings->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON)) /* check the mode for auto-keyframing (per scene takes precedence) */ #define IS_AUTOKEY_MODE(scene, mode) \ - ((scene) ? (scene->toolsettings->autokey_mode == AUTOKEY_MODE_##mode) : \ + ((scene) ? ((scene)->toolsettings->autokey_mode == AUTOKEY_MODE_##mode) : \ (U.autokey_mode == AUTOKEY_MODE_##mode)) /* check if a flag is set for auto-keyframing (per scene takes precedence) */ #define IS_AUTOKEY_FLAG(scene, flag) \ - ((scene) ? ((scene->toolsettings->autokey_flag & AUTOKEY_FLAG_##flag) || \ + ((scene) ? (((scene)->toolsettings->autokey_flag & AUTOKEY_FLAG_##flag) || \ (U.autokey_flag & AUTOKEY_FLAG_##flag)) : \ (U.autokey_flag & AUTOKEY_FLAG_##flag)) diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index b0acc54f1ec..43f3a578bfe 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -215,7 +215,7 @@ ScrArea *ED_screen_areas_iter_next(const bScreen *screen, const ScrArea *area); #define ED_screen_verts_iter(win, screen, vert_name) \ for (ScrVert *vert_name = (win)->global_areas.vertbase.first ? \ (win)->global_areas.vertbase.first : \ - screen->vertbase.first; \ + (screen)->vertbase.first; \ vert_name != NULL; \ vert_name = (vert_name == (win)->global_areas.vertbase.last) ? (screen)->vertbase.first : \ vert_name->next) diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index fb40ae195ef..90092817acc 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -193,7 +193,8 @@ typedef enum { /* is the current element open? if so we also show children */ #define TSELEM_OPEN(telm, sv) \ - ((telm->flag & TSE_CLOSED) == 0 || (SEARCHING_OUTLINER(sv) && (telm->flag & TSE_CHILDSEARCH))) + (((telm)->flag & TSE_CLOSED) == 0 || \ + (SEARCHING_OUTLINER(sv) && ((telm)->flag & TSE_CHILDSEARCH))) /** * Container to avoid passing around these variables to many functions. diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h index d5114d8f6b5..d6588dda797 100644 --- a/source/blender/editors/space_text/text_intern.h +++ b/source/blender/editors/space_text/text_intern.h @@ -48,13 +48,13 @@ void text_update_cursor_moved(struct bContext *C); #define TXT_NUMCOL_PAD 1.0f /* Total width of the optional line numbers column. */ #define TXT_NUMCOL_WIDTH(st) \ - (st->runtime.cwidth_px * (st->runtime.line_number_display_digits + (2 * TXT_NUMCOL_PAD))) + ((st)->runtime.cwidth_px * ((st)->runtime.line_number_display_digits + (2 * TXT_NUMCOL_PAD))) /* Padding on left of body text in character units. */ #define TXT_BODY_LPAD 1.0f /* Left position of body text. */ #define TXT_BODY_LEFT(st) \ - (st->showlinenrs ? TXT_NUMCOL_WIDTH(st) : 0) + (TXT_BODY_LPAD * st->runtime.cwidth_px) + ((st)->showlinenrs ? TXT_NUMCOL_WIDTH(st) : 0) + (TXT_BODY_LPAD * (st)->runtime.cwidth_px) #define TXT_SCROLL_WIDTH U.widget_unit #define TXT_SCROLL_SPACE ((int)(0.1f * U.widget_unit)) diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 9e225b842f1..701e068d3fa 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -967,14 +967,14 @@ bool checkUseAxisMatrix(TransInfo *t); (BLI_assert((t)->data_container_len == 1), (&(t)->data_container[0])) #define FOREACH_TRANS_DATA_CONTAINER(t, th) \ - for (TransDataContainer *tc = t->data_container, \ - *tc_end = t->data_container + t->data_container_len; \ + for (TransDataContainer *tc = (t)->data_container, \ + *tc_end = (t)->data_container + (t)->data_container_len; \ th != tc_end; \ th++) #define FOREACH_TRANS_DATA_CONTAINER_INDEX(t, th, i) \ - for (TransDataContainer *tc = ((i = 0), t->data_container), \ - *tc_end = t->data_container + t->data_container_len; \ + for (TransDataContainer *tc = ((i = 0), (t)->data_container), \ + *tc_end = (t)->data_container + (t)->data_container_len; \ th != tc_end; \ th++, i++) |