From 41a1bbffc6238b0ed52b55f58ba884fe2f26e11f Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Fri, 11 Mar 2022 10:58:55 -0800 Subject: 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 Change-Id: I2e53a2bfa6e56a89af62d6ddc073ead58b8c49bb --- src/vppinfra/heap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/vppinfra/heap.c') diff --git a/src/vppinfra/heap.c b/src/vppinfra/heap.c index bc22da1d8f6..b54987abe5e 100644 --- a/src/vppinfra/heap.c +++ b/src/vppinfra/heap.c @@ -640,10 +640,10 @@ heap_bytes (void *v) bytes = sizeof (h[0]); bytes += vec_len (v) * sizeof (h->elt_bytes); for (b = 0; b < vec_len (h->free_lists); b++) - bytes += vec_capacity (h->free_lists[b], 0); + bytes += vec_mem_size (h->free_lists[b], 0); bytes += vec_bytes (h->free_lists); - bytes += vec_capacity (h->elts, 0); - bytes += vec_capacity (h->free_elts, 0); + bytes += vec_mem_size (h->elts, 0); + bytes += vec_mem_size (h->free_elts, 0); bytes += vec_bytes (h->used_elt_bitmap); return bytes; -- cgit 1.2.3-korg