diff options
author | Damjan Marion <damarion@cisco.com> | 2020-12-13 21:47:40 +0100 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-12-14 12:14:21 +0000 |
commit | b2c31b685fd2cf28436ca32bc93e23eb24c74878 (patch) | |
tree | dc0a1b1ff784445b2cbb0f9b2c07b5bcb4f5a5d0 /src/vppinfra/pool.h | |
parent | 62c25abaa3e93be5815172d391295a6ab0390122 (diff) |
misc: move to new pool_foreach macros
Type: refactor
Change-Id: Ie67dc579e88132ddb1ee4a34cb69f96920101772
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/pool.h')
-rw-r--r-- | src/vppinfra/pool.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/vppinfra/pool.h b/src/vppinfra/pool.h index d7be8cb1f01..116c1cd1321 100644 --- a/src/vppinfra/pool.h +++ b/src/vppinfra/pool.h @@ -524,14 +524,14 @@ do { \ vec_foreach() (or plain for-loop) to walk the active index vector. */ -#define pool_foreach2(VAR,POOL) \ +#define pool_foreach(VAR,POOL) \ if (POOL) \ for (VAR = POOL + pool_get_first_index (POOL); \ VAR < vec_end (POOL); \ VAR = POOL + pool_get_next_index (POOL, VAR - POOL)) -#define pool_foreach(VAR,POOL,BODY) \ - pool_foreach2(VAR,POOL) \ +#define pool_foreach_old(VAR,POOL,BODY) \ + pool_foreach(VAR,POOL) \ { BODY; } /** Returns pointer to element at given index. @@ -566,15 +566,15 @@ do { \ _pool_var(rv); \ }) -#define pool_foreach_index2(i,v) \ +#define pool_foreach_index(i,v) \ if (v) \ for (i = pool_get_first_index (v); \ i < vec_len (v); \ i = pool_get_next_index (v, i)) \ /** Iterate pool by index. */ -#define pool_foreach_index(i,v,body) \ - pool_foreach_index2 (i,v) \ +#define pool_foreach_index_old(i,v,body) \ + pool_foreach_index (i,v) \ { body; } /** @@ -589,10 +589,10 @@ do { \ { \ uword *_pool_var(ii), *_pool_var(dv) = NULL; \ \ - pool_foreach((VAR), (POOL), \ - ({ \ + pool_foreach((VAR), (POOL)) \ + { \ vec_add1(_pool_var(dv), (VAR) - (POOL)); \ - })); \ + } \ vec_foreach(_pool_var(ii), _pool_var(dv)) \ { \ (VAR) = pool_elt_at_index((POOL), *_pool_var(ii)); \ |