vppinfra: deprecate vec_free_h()
vec_free() does the work Type: refactor Change-Id: I8a97607c3b2f58d116863642b32b55525dc15d88 Signed-off-by: Damjan Marion <damarion@cisco.com>
This commit is contained in:

committed by
Damjan Marion

parent
a4a28f04cb
commit
05563c9a90
@ -254,7 +254,7 @@ clib_fifo_tail_index (void *v)
|
|||||||
#define clib_fifo_head(v) ((v) + clib_fifo_head_index (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_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
|
always_inline uword
|
||||||
clib_fifo_elt_index (void *v, uword i)
|
clib_fifo_elt_index (void *v, uword i)
|
||||||
|
@ -624,7 +624,7 @@ _heap_free (void *v)
|
|||||||
vec_free (h->free_elts);
|
vec_free (h->free_elts);
|
||||||
vec_free (h->small_free_elt_free_index);
|
vec_free (h->small_free_elt_free_index);
|
||||||
if (!(h->flags & HEAP_IS_STATIC))
|
if (!(h->flags & HEAP_IS_STATIC))
|
||||||
vec_free_h (v, sizeof (h[0]));
|
vec_free (v);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ _pool_free (void *v)
|
|||||||
clib_bitmap_free (p->free_bitmap);
|
clib_bitmap_free (p->free_bitmap);
|
||||||
|
|
||||||
vec_free (p->free_indices);
|
vec_free (p->free_indices);
|
||||||
vec_free_h (v, pool_aligned_header_bytes);
|
vec_free (v);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ clib_ring_new_inline (void **p, u32 elt_bytes, u32 size, u32 align)
|
|||||||
#define clib_ring_new(ring, size) \
|
#define clib_ring_new(ring, size) \
|
||||||
{ clib_ring_new_inline ((void **)&(ring), sizeof(ring[0]), size, 0);}
|
{ 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
|
always_inline u32
|
||||||
clib_ring_n_enq (void *v)
|
clib_ring_n_enq (void *v)
|
||||||
|
@ -189,7 +189,7 @@ main (int argc, char *argv[])
|
|||||||
vec_free (handles);
|
vec_free (handles);
|
||||||
|
|
||||||
if (fixed_size)
|
if (fixed_size)
|
||||||
vec_free_h (h, sizeof (heap_header_t));
|
vec_free (h);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
fformat (stderr, "%U\n", format_clib_mem_usage, /* verbose */ 0);
|
fformat (stderr, "%U\n", format_clib_mem_usage, /* verbose */ 0);
|
||||||
|
@ -259,7 +259,7 @@ validate_vec_free (elt_t * vec)
|
|||||||
static elt_t *
|
static elt_t *
|
||||||
validate_vec_free_h (elt_t * vec, uword hdr_bytes)
|
validate_vec_free_h (elt_t * vec, uword hdr_bytes)
|
||||||
{
|
{
|
||||||
vec_free_h (vec, hdr_bytes);
|
vec_free (vec);
|
||||||
ASSERT (vec == NULL);
|
ASSERT (vec == NULL);
|
||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
@ -799,7 +799,7 @@ run_validator_wh (uword iter)
|
|||||||
{
|
{
|
||||||
case OP_IS_VEC_INIT_H:
|
case OP_IS_VEC_INIT_H:
|
||||||
num_elts = bounded_random_u32 (&g_seed, 0, MAX_CHANGE);
|
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);
|
VERBOSE2 ("vec_init_h(), new elts %d\n", num_elts);
|
||||||
vec = validate_vec_init_h (num_elts, sizeof (hdr_t));
|
vec = validate_vec_init_h (num_elts, sizeof (hdr_t));
|
||||||
break;
|
break;
|
||||||
@ -840,7 +840,7 @@ run_validator_wh (uword iter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
validate_vec (vec, sizeof (hdr_t));
|
validate_vec (vec, sizeof (hdr_t));
|
||||||
vec_free_h (vec, sizeof (hdr_t));
|
vec_free (vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -373,13 +373,11 @@ do { \
|
|||||||
*/
|
*/
|
||||||
#define vec_new_aligned(T,N,A) vec_new_ha(T,N,0,A)
|
#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 V pointer to a vector
|
||||||
@param H size of header in bytes
|
|
||||||
@return V (value-result parameter, V=0)
|
@return V (value-result parameter, V=0)
|
||||||
*/
|
*/
|
||||||
#define vec_free_h(V, H) \
|
#define vec_free(V) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
if (V) \
|
if (V) \
|
||||||
@ -390,12 +388,6 @@ do { \
|
|||||||
} \
|
} \
|
||||||
while (0)
|
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);
|
void vec_free_not_inline (void *v);
|
||||||
|
|
||||||
/**\brief Free vector user header (syntactic sugar)
|
/**\brief Free vector user header (syntactic sugar)
|
||||||
|
Reference in New Issue
Block a user