kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=fd9270d4d2647c2dff58b4e33326c1f76cfa75d2
commit fd9270d4d2647c2dff58b4e33326c1f76cfa75d2 Author: Kim Woelders <[email protected]> Date: Mon Apr 4 11:38:11 2022 +0200 stacking: Refactor EwinListStackGet() --- src/stacking.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/stacking.c b/src/stacking.c index 1568b953..4e6af1f4 100644 --- a/src/stacking.c +++ b/src/stacking.c @@ -37,6 +37,10 @@ typedef struct { int nobjs; EObj **list; } o; + struct { + int nalloc; + EWin **list; + } e; char layered; } EobjList; @@ -348,34 +352,35 @@ EobjListFocusRaise(EObj * eo) return EobjListRaise(&EwinListFocus, eo, 0); } -EWin *const * -EwinListStackGet(int *num) +static EWin *const * +_EwinListGet(EobjList * eol, int *pnum) { - static EWin **lst = NULL; - static int nalloc = 0; - const EobjList *eol; int i, j; EObj *eo; - eol = &EobjListStack; - for (i = j = 0; i < eol->o.nobjs; i++) { eo = eol->o.list[i]; if (eo->type != EOBJ_TYPE_EWIN) continue; - if (nalloc <= j) + if (eol->e.nalloc <= j) { - nalloc += 16; /* 16 at the time */ - lst = EREALLOC(EWin *, lst, nalloc); + eol->e.nalloc += 16; /* 16 at the time */ + eol->e.list = EREALLOC(EWin *, eol->e.list, eol->e.nalloc); } - lst[j++] = (EWin *) eo; + eol->e.list[j++] = (EWin *) eo; } - *num = j; - return lst; + *pnum = j; + return eol->e.list; +} + +EWin *const * +EwinListStackGet(int *num) +{ + return _EwinListGet(&EobjListStack, num); } EWin *const * --
