diff options
author | Dalai Felinto <dalai@blender.org> | 2020-04-03 20:15:01 +0300 |
---|---|---|
committer | Dalai Felinto <dalai@blender.org> | 2020-04-03 20:27:46 +0300 |
commit | d138cbfb47e379edc1ee915a8c6ff65b01f000d6 (patch) | |
tree | f4773ecce897c32eaf75295dd5f6a8e730d471ed /source/blender/editors/space_outliner/outliner_utils.c | |
parent | b0c1184875d39abac4a65a5d20e263ea6d841009 (diff) |
Code Quality: Replace for loops with LISTBASE_FOREACH
Note this only changes cases where the variable was declared inside
the for loop. To handle it outside as well is a different challenge.
Differential Revision: https://developer.blender.org/D7320
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_utils.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_utils.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/editors/space_outliner/outliner_utils.c b/source/blender/editors/space_outliner/outliner_utils.c index 188a4e64897..a058c30cef2 100644 --- a/source/blender/editors/space_outliner/outliner_utils.c +++ b/source/blender/editors/space_outliner/outliner_utils.c @@ -78,7 +78,7 @@ TreeElement *outliner_find_item_at_y(const SpaceOutliner *soops, const ListBase *tree, float view_co_y) { - for (TreeElement *te_iter = tree->first; te_iter; te_iter = te_iter->next) { + LISTBASE_FOREACH (TreeElement *, te_iter, tree) { if (view_co_y < (te_iter->ys + UI_UNIT_Y)) { if (view_co_y >= te_iter->ys) { /* co_y is inside this element */ @@ -204,7 +204,7 @@ TreeElement *outliner_find_tse(SpaceOutliner *soops, const TreeStoreElem *tse) /* Find treestore that refers to given ID */ TreeElement *outliner_find_id(SpaceOutliner *soops, ListBase *lb, const ID *id) { - for (TreeElement *te = lb->first; te; te = te->next) { + LISTBASE_FOREACH (TreeElement *, te, lb) { TreeStoreElem *tselem = TREESTORE(te); if (tselem->type == 0) { if (tselem->id == id) { @@ -222,7 +222,7 @@ TreeElement *outliner_find_id(SpaceOutliner *soops, ListBase *lb, const ID *id) TreeElement *outliner_find_posechannel(ListBase *lb, const bPoseChannel *pchan) { - for (TreeElement *te = lb->first; te; te = te->next) { + LISTBASE_FOREACH (TreeElement *, te, lb) { if (te->directdata == pchan) { return te; } @@ -240,7 +240,7 @@ TreeElement *outliner_find_posechannel(ListBase *lb, const bPoseChannel *pchan) TreeElement *outliner_find_editbone(ListBase *lb, const EditBone *ebone) { - for (TreeElement *te = lb->first; te; te = te->next) { + LISTBASE_FOREACH (TreeElement *, te, lb) { if (te->directdata == ebone) { return te; } @@ -361,7 +361,7 @@ float outliner_restrict_columns_width(const SpaceOutliner *soops) /* Find first tree element in tree with matching treestore flag */ TreeElement *outliner_find_element_with_flag(const ListBase *lb, short flag) { - for (TreeElement *te = lb->first; te; te = te->next) { + LISTBASE_FOREACH (TreeElement *, te, lb) { if ((TREESTORE(te)->flag & flag) == flag) { return te; } |