[Bf-blender-cvs] [e06f5f64aea] master: Cleanup: Use LISTBASE_FOREACH and LISTBASE_FOREACH_MUTABLE macro

Germano Cavalcante noreply at git.blender.org
Mon Mar 1 13:35:35 CET 2021


Commit: e06f5f64aeac914c17cfc267b1335869d0f24309
Author: Germano Cavalcante
Date:   Mon Mar 1 09:35:15 2021 -0300
Branches: master
https://developer.blender.org/rBe06f5f64aeac914c17cfc267b1335869d0f24309

Cleanup: Use LISTBASE_FOREACH and LISTBASE_FOREACH_MUTABLE macro

===================================================================

M	source/blender/editors/space_api/spacetypes.c
M	source/blender/windowmanager/intern/wm_operators.c

===================================================================

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;
   }
 }



More information about the Bf-blender-cvs mailing list