summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-03-17 18:29:32 +0100
committerDamjan Marion <dmarion@me.com>2022-03-18 13:16:30 +0000
commit05563c9a904b6bb862ba783dc3519c8415bf9cf5 (patch)
tree6243fbfe79969288ad233a45433f74fec75edb08
parenta4a28f04cb887ee690ccc9f563d06bf74fe18faf (diff)
vppinfra: deprecate vec_free_h()
vec_free() does the work Type: refactor Change-Id: I8a97607c3b2f58d116863642b32b55525dc15d88 Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--src/vppinfra/fifo.h2
-rw-r--r--src/vppinfra/heap.c2
-rw-r--r--src/vppinfra/pool.h2
-rw-r--r--src/vppinfra/ring.h2
-rw-r--r--src/vppinfra/test_heap.c2
-rw-r--r--src/vppinfra/test_vec.c6
-rw-r--r--src/vppinfra/vec.h12
7 files changed, 10 insertions, 18 deletions
diff --git a/src/vppinfra/fifo.h b/src/vppinfra/fifo.h
index 496f5dd17c5..f1ba7aa2ee7 100644
--- a/src/vppinfra/fifo.h
+++ b/src/vppinfra/fifo.h
@@ -254,7 +254,7 @@ clib_fifo_tail_index (void *v)
#define clib_fifo_head(v) ((v) + clib_fifo_head_index (v))
#define clib_fifo_tail(v) ((v) + clib_fifo_tail_index (v))
-#define clib_fifo_free(f) vec_free_h((f),sizeof(clib_fifo_header_t))
+#define clib_fifo_free(f) vec_free ((f))
always_inline uword
clib_fifo_elt_index (void *v, uword i)
diff --git a/src/vppinfra/heap.c b/src/vppinfra/heap.c
index b724f88fdae..bc3e8cb79c9 100644
--- a/src/vppinfra/heap.c
+++ b/src/vppinfra/heap.c
@@ -624,7 +624,7 @@ _heap_free (void *v)
vec_free (h->free_elts);
vec_free (h->small_free_elt_free_index);
if (!(h->flags & HEAP_IS_STATIC))
- vec_free_h (v, sizeof (h[0]));
+ vec_free (v);
return v;
}
diff --git a/src/vppinfra/pool.h b/src/vppinfra/pool.h
index 1b1d54c1daa..9fca6562716 100644
--- a/src/vppinfra/pool.h
+++ b/src/vppinfra/pool.h
@@ -427,7 +427,7 @@ _pool_free (void *v)
clib_bitmap_free (p->free_bitmap);
vec_free (p->free_indices);
- vec_free_h (v, pool_aligned_header_bytes);
+ vec_free (v);
return 0;
}
diff --git a/src/vppinfra/ring.h b/src/vppinfra/ring.h
index 2f90b8269a6..52b4261e4e6 100644
--- a/src/vppinfra/ring.h
+++ b/src/vppinfra/ring.h
@@ -56,7 +56,7 @@ clib_ring_new_inline (void **p, u32 elt_bytes, u32 size, u32 align)
#define clib_ring_new(ring, size) \
{ clib_ring_new_inline ((void **)&(ring), sizeof(ring[0]), size, 0);}
-#define clib_ring_free(f) vec_free_h((f), sizeof(clib_ring_header_t))
+#define clib_ring_free(f) vec_free ((f))
always_inline u32
clib_ring_n_enq (void *v)
diff --git a/src/vppinfra/test_heap.c b/src/vppinfra/test_heap.c
index 0fd6bf74245..00c896e5c9a 100644
--- a/src/vppinfra/test_heap.c
+++ b/src/vppinfra/test_heap.c
@@ -189,7 +189,7 @@ main (int argc, char *argv[])
vec_free (handles);
if (fixed_size)
- vec_free_h (h, sizeof (heap_header_t));
+ vec_free (h);
if (verbose)
fformat (stderr, "%U\n", format_clib_mem_usage, /* verbose */ 0);
diff --git a/src/vppinfra/test_vec.c b/src/vppinfra/test_vec.c
index 28d945ee15f..cd461375893 100644
--- a/src/vppinfra/test_vec.c
+++ b/src/vppinfra/test_vec.c
@@ -259,7 +259,7 @@ validate_vec_free (elt_t * vec)
static elt_t *
validate_vec_free_h (elt_t * vec, uword hdr_bytes)
{
- vec_free_h (vec, hdr_bytes);
+ vec_free (vec);
ASSERT (vec == NULL);
return vec;
}
@@ -799,7 +799,7 @@ run_validator_wh (uword iter)
{
case OP_IS_VEC_INIT_H:
num_elts = bounded_random_u32 (&g_seed, 0, MAX_CHANGE);
- vec_free_h (vec, sizeof (hdr_t));
+ vec_free (vec);
VERBOSE2 ("vec_init_h(), new elts %d\n", num_elts);
vec = validate_vec_init_h (num_elts, sizeof (hdr_t));
break;
@@ -840,7 +840,7 @@ run_validator_wh (uword iter)
}
validate_vec (vec, sizeof (hdr_t));
- vec_free_h (vec, sizeof (hdr_t));
+ vec_free (vec);
}
static void
diff --git a/src/vppinfra/vec.h b/src/vppinfra/vec.h
index e8eb586fca9..3f50bd25625 100644
--- a/src/vppinfra/vec.h
+++ b/src/vppinfra/vec.h
@@ -373,13 +373,11 @@ do { \
*/
#define vec_new_aligned(T,N,A) vec_new_ha(T,N,0,A)
-/** \brief Free vector's memory (general version)
-
+/** \brief Free vector's memory (no header).
@param V pointer to a vector
- @param H size of header in bytes
@return V (value-result parameter, V=0)
*/
-#define vec_free_h(V, H) \
+#define vec_free(V) \
do \
{ \
if (V) \
@@ -390,12 +388,6 @@ do { \
} \
while (0)
-/** \brief Free vector's memory (no header).
- @param V pointer to a vector
- @return V (value-result parameter, V=0)
-*/
-#define vec_free(V) vec_free_h(V,0)
-
void vec_free_not_inline (void *v);
/**\brief Free vector user header (syntactic sugar)