From d138cbfb47e379edc1ee915a8c6ff65b01f000d6 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 3 Apr 2020 19:15:01 +0200 Subject: 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 --- source/blender/editors/undo/ed_undo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/undo') diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c index 39ecbad1807..69e7c04b5e5 100644 --- a/source/blender/editors/undo/ed_undo.c +++ b/source/blender/editors/undo/ed_undo.c @@ -816,7 +816,7 @@ static int undo_editmode_objects_from_view_layer_prepare(ViewLayer *view_layer, { const short object_type = obact->type; - for (Base *base = view_layer->object_bases.first; base; base = base->next) { + LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { Object *ob = base->object; if ((ob->type == object_type) && (ob->mode & OB_MODE_EDIT)) { ID *id = ob->data; @@ -825,7 +825,7 @@ static int undo_editmode_objects_from_view_layer_prepare(ViewLayer *view_layer, } int len = 0; - for (Base *base = view_layer->object_bases.first; base; base = base->next) { + LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { Object *ob = base->object; if ((ob->type == object_type) && (ob->mode & OB_MODE_EDIT)) { if (ob == obact) { @@ -852,7 +852,7 @@ Object **ED_undo_editmode_objects_from_view_layer(ViewLayer *view_layer, uint *r const short object_type = obact->type; int i = 0; Object **objects = MEM_malloc_arrayN(len, sizeof(*objects), __func__); - for (Base *base = view_layer->object_bases.first; base; base = base->next) { + LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { Object *ob = base->object; if ((ob->type == object_type) && (ob->mode & OB_MODE_EDIT)) { ID *id = ob->data; @@ -881,7 +881,7 @@ Base **ED_undo_editmode_bases_from_view_layer(ViewLayer *view_layer, uint *r_len const short object_type = obact->type; int i = 0; Base **base_array = MEM_malloc_arrayN(len, sizeof(*base_array), __func__); - for (Base *base = view_layer->object_bases.first; base; base = base->next) { + LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { Object *ob = base->object; if ((ob->type == object_type) && (ob->mode & OB_MODE_EDIT)) { ID *id = ob->data; -- cgit v1.2.3