vppinfra: deprecate vec_free_h()
vec_free() does the work
Type: refactor
Change-Id: I8a97607c3b2f58d116863642b32b55525dc15d88
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vppinfra/fifo.h b/src/vppinfra/fifo.h
index 496f5dd..f1ba7aa 100644
--- a/src/vppinfra/fifo.h
+++ b/src/vppinfra/fifo.h
@@ -254,7 +254,7 @@
#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 b724f88..bc3e8cb 100644
--- a/src/vppinfra/heap.c
+++ b/src/vppinfra/heap.c
@@ -624,7 +624,7 @@
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 1b1d54c..9fca656 100644
--- a/src/vppinfra/pool.h
+++ b/src/vppinfra/pool.h
@@ -427,7 +427,7 @@
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 2f90b82..52b4261 100644
--- a/src/vppinfra/ring.h
+++ b/src/vppinfra/ring.h
@@ -56,7 +56,7 @@
#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 0fd6bf7..00c896e 100644
--- a/src/vppinfra/test_heap.c
+++ b/src/vppinfra/test_heap.c
@@ -189,7 +189,7 @@
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 28d945e..cd46137 100644
--- a/src/vppinfra/test_vec.c
+++ b/src/vppinfra/test_vec.c
@@ -259,7 +259,7 @@
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 @@
{
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 @@
}
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 e8eb586..3f50bd2 100644
--- a/src/vppinfra/vec.h
+++ b/src/vppinfra/vec.h
@@ -373,13 +373,11 @@
*/
#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 @@
} \
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)