diff options
author | Benoît Ganne <bganne@cisco.com> | 2019-10-22 18:19:00 +0200 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2019-10-31 12:15:48 +0000 |
commit | abe07c8a25a566fd5f7441503a1541b5421c1ad7 (patch) | |
tree | cb61457d275236752c09932de2ebcbd9fd9514f9 | |
parent | 952d4e7fb9fce28c36f8ff05a0a20ce528aa45f7 (diff) |
vppinfra: make coverity happy with vec_set_len
Coverity gets confused by ASSERT((l) <= vec_max_len(v)) when l is 0.
Type: fix
Change-Id: I247d7015b148233d8f195bcf41e9a047b7a21309
Signed-off-by: Benoît Ganne <bganne@cisco.com>
(cherry picked from commit 70d5d4fa09520bd5825b49960ae896beca3535e8)
-rw-r--r-- | src/vppinfra/vec_bootstrap.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/vppinfra/vec_bootstrap.h b/src/vppinfra/vec_bootstrap.h index 7fb016fe8d2..5c42e5ea914 100644 --- a/src/vppinfra/vec_bootstrap.h +++ b/src/vppinfra/vec_bootstrap.h @@ -160,16 +160,21 @@ vec_aligned_header_end (void *v, uword header_bytes, uword align) #define vec_max_len(v) (vec_capacity(v,0) / sizeof (v[0])) /** \brief Set vector length to a user-defined value */ +#ifndef __COVERITY__ /* Coverity gets confused by ASSERT() */ #define vec_set_len(v, l) do { \ ASSERT(v); \ ASSERT((l) <= vec_max_len(v)); \ _vec_len(v) = (l); \ } while (0) +#else /* __COVERITY__ */ +#define vec_set_len(v, l) do { \ + _vec_len(v) = (l); \ +} while (0) +#endif /* __COVERITY__ */ /** \brief Reset vector length to zero NULL-pointer tolerant */ - #define vec_reset_length(v) do { if (v) vec_set_len (v, 0); } while (0) /** \brief End (last data address) of vector. */ |