diff options
author | Florin Coras <fcoras@cisco.com> | 2022-03-11 10:58:55 -0800 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2022-03-14 22:03:37 +0000 |
commit | 41a1bbffc6238b0ed52b55f58ba884fe2f26e11f (patch) | |
tree | ea254eca7e168fcec23bc9bfcec43086974025c7 /src/vppinfra/hash.c | |
parent | 58fd481d73dce9c276facb42b9a9c3488c25417d (diff) |
vppinfra: fix vec capacity
Rename vec_capacity to vec_mem_size as it returned the size of the
underlying memory allocation not the number of bytes that can be used
for vector elements.
Add new vec_max_elts macro that returns number of elements that can fit
into generic vector.
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I2e53a2bfa6e56a89af62d6ddc073ead58b8c49bb
Diffstat (limited to 'src/vppinfra/hash.c')
-rw-r--r-- | src/vppinfra/hash.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vppinfra/hash.c b/src/vppinfra/hash.c index c7774bb87ef..63dab989852 100644 --- a/src/vppinfra/hash.c +++ b/src/vppinfra/hash.c @@ -1003,7 +1003,7 @@ hash_bytes (void *v) if (!v) return 0; - bytes = vec_capacity (v, hash_header_bytes (v)); + bytes = vec_mem_size (v, hash_header_bytes (v)); for (i = 0; i < hash_capacity (v); i++) { @@ -1013,7 +1013,7 @@ hash_bytes (void *v) if (h->log2_pair_size > 0) bytes += 1 << indirect_pair_get_log2_bytes (&p->indirect); else - bytes += vec_capacity (p->indirect.pairs, 0); + bytes += vec_mem_size (p->indirect.pairs, 0); } } return bytes; |