diff options
author | Neale Ranns <nranns@cisco.com> | 2019-12-06 05:53:17 +0000 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2019-12-16 23:29:21 +0000 |
commit | f50bac1bb25b02d7f086627c4c0a0709ee0f61d5 (patch) | |
tree | 26408a8b3d80f0e2eae7900aa8e49f37ac6de3b8 /src/vppinfra/bihash_template.c | |
parent | 77cfc0171da0fa2b305378731a5fefd659d8947d (diff) |
vppinfra: bihash walk cb typedef and continue/stop controls
Type: feature
Change-Id: I28f7a658be3f3beec9ea32635b60d1d3a10d9b06
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vppinfra/bihash_template.c')
-rw-r--r-- | src/vppinfra/bihash_template.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/vppinfra/bihash_template.c b/src/vppinfra/bihash_template.c index 97c4cd08eb1..b090041ad29 100644 --- a/src/vppinfra/bihash_template.c +++ b/src/vppinfra/bihash_template.c @@ -906,12 +906,12 @@ u8 *BV (format_bihash) (u8 * s, va_list * args) } void BV (clib_bihash_foreach_key_value_pair) - (BVT (clib_bihash) * h, void *callback, void *arg) + (BVT (clib_bihash) * h, + BV (clib_bihash_foreach_key_value_pair_cb) cb, void *arg) { int i, j, k; BVT (clib_bihash_bucket) * b; BVT (clib_bihash_value) * v; - void (*fp) (BVT (clib_bihash_kv) *, void *) = callback; if (PREDICT_FALSE (alloc_arena (h) == 0)) return; @@ -930,7 +930,8 @@ void BV (clib_bihash_foreach_key_value_pair) if (BV (clib_bihash_is_free) (&v->kvp[k])) continue; - (*fp) (&v->kvp[k], arg); + if (BIHASH_WALK_STOP == cb (&v->kvp[k], arg)) + return; /* * In case the callback deletes the last entry in the bucket... */ |