diff options
author | Adrian Moreno <amorenoz@redhat.com> | 2022-03-23 12:56:18 +0100 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2022-03-30 16:59:02 +0200 |
commit | ef39616486bd8081d7ff620353a3a3d19dbb20ad (patch) | |
tree | f5b666c76b552fd8173f2d8c7fbee56cdf34c50b /tests | |
parent | 9e56549c2bba79e644de2d3876b363553175210c (diff) | |
download | openvswitch-ef39616486bd8081d7ff620353a3a3d19dbb20ad.tar.gz |
cmap: use multi-variable iterators.
Re-write cmap's loops using multi-variable helpers.
For iterators based on cmap_cursor, we just need to make sure the NODE
variable is not used after the loop, so we set it to NULL.
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-cmap.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/test-cmap.c b/tests/test-cmap.c index bc1f45642..588a5dea6 100644 --- a/tests/test-cmap.c +++ b/tests/test-cmap.c @@ -74,6 +74,7 @@ check_cmap(struct cmap *cmap, const int values[], size_t n, cmap_values[i++] = e->value; } assert(i == n); + assert(e == NULL); /* Here we test iteration with cmap_next_position() */ i = 0; @@ -107,6 +108,7 @@ check_cmap(struct cmap *cmap, const int values[], size_t n, count += e->value == values[i]; } assert(count == 1); + assert(e == NULL); } /* Check that all the values are there in batched lookup. */ @@ -130,6 +132,7 @@ check_cmap(struct cmap *cmap, const int values[], size_t n, CMAP_NODE_FOR_EACH (e, node, nodes[k]) { count += e->value == values[i + k]; } + assert(e == NULL); } assert(count == j); /* j elements in a batch. */ } |