From e06f5f64aeac914c17cfc267b1335869d0f24309 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Mon, 1 Mar 2021 09:35:15 -0300 Subject: Cleanup: Use LISTBASE_FOREACH and LISTBASE_FOREACH_MUTABLE macro --- source/blender/windowmanager/intern/wm_operators.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'source/blender/windowmanager/intern/wm_operators.c') diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index f96c45f8a05..d829b812882 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2046,7 +2046,7 @@ wmPaintCursor *WM_paint_cursor_activate(short space_type, bool WM_paint_cursor_end(wmPaintCursor *handle) { wmWindowManager *wm = G_MAIN->wm.first; - for (wmPaintCursor *pc = wm->paintcursors.first; pc; pc = pc->next) { + LISTBASE_FOREACH (wmPaintCursor *, pc, &wm->paintcursors) { if (pc == (wmPaintCursor *)handle) { BLI_remlink(&wm->paintcursors, pc); MEM_freeN(pc); @@ -2058,9 +2058,7 @@ bool WM_paint_cursor_end(wmPaintCursor *handle) void WM_paint_cursor_remove_by_type(wmWindowManager *wm, void *draw_fn, void (*free)(void *)) { - wmPaintCursor *pc = wm->paintcursors.first; - while (pc) { - wmPaintCursor *pc_next = pc->next; + LISTBASE_FOREACH_MUTABLE (wmPaintCursor *, pc, &wm->paintcursors) { if (pc->draw == draw_fn) { if (free) { free(pc->customdata); @@ -2068,7 +2066,6 @@ void WM_paint_cursor_remove_by_type(wmWindowManager *wm, void *draw_fn, void (*f BLI_remlink(&wm->paintcursors, pc); MEM_freeN(pc); } - pc = pc_next; } } -- cgit v1.2.3