Cleanup: Use LISTBASE_FOREACH and LISTBASE_FOREACH_MUTABLE macro

This commit is contained in:
Germano Cavalcante 2021-03-01 09:35:15 -03:00
parent 4b3dcd8069
commit e06f5f64ae
2 changed files with 3 additions and 9 deletions

View File

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

View File

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