diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-03-01 15:35:15 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-03-01 15:35:27 +0300 |
commit | e06f5f64aeac914c17cfc267b1335869d0f24309 (patch) | |
tree | e50e9b8b42e732bfa973bbc0d0a4e2fdfa02e764 | |
parent | 4b3dcd80698a01de6cbf2d7f0d9abeac52cf6523 (diff) |
Cleanup: Use LISTBASE_FOREACH and LISTBASE_FOREACH_MUTABLE macro
-rw-r--r-- | source/blender/editors/space_api/spacetypes.c | 5 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 7 |
2 files changed, 3 insertions, 9 deletions
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index c112c678a09..1bd8d13b25b 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -274,9 +274,7 @@ void ED_region_draw_cb_draw(const bContext *C, ARegion *region, int type) void ED_region_draw_cb_remove_by_type(ARegionType *art, void *draw_fn, void (*free)(void *)) { - RegionDrawCB *rdc = art->drawcalls.first; - while (rdc) { - RegionDrawCB *rdc_next = rdc->next; + LISTBASE_FOREACH_MUTABLE (RegionDrawCB *, rdc, &art->drawcalls) { if (rdc->draw == draw_fn) { if (free) { free(rdc->customdata); @@ -284,7 +282,6 @@ void ED_region_draw_cb_remove_by_type(ARegionType *art, void *draw_fn, void (*fr BLI_remlink(&art->drawcalls, rdc); MEM_freeN(rdc); } - rdc = rdc_next; } } 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; } } |