diff options
-rw-r--r-- | src/vppinfra/test_vec.c | 2 | ||||
-rw-r--r-- | src/vppinfra/vec.h | 18 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/vppinfra/test_vec.c b/src/vppinfra/test_vec.c index 4bfffd121a2..f32cd7ffb82 100644 --- a/src/vppinfra/test_vec.c +++ b/src/vppinfra/test_vec.c @@ -676,7 +676,7 @@ validate_vec_init_h (uword num_elts, uword hdr_bytes) uword len; elt_t *new; - new = vec_new_ha (elt_t, num_elts, hdr_bytes, 0); + new = vec_new_generic (elt_t, num_elts, hdr_bytes, 0, 0); len = vec_len (new); ASSERT (len == num_elts); diff --git a/src/vppinfra/vec.h b/src/vppinfra/vec.h index 1dc300ad1ea..bfb7b1b7fc6 100644 --- a/src/vppinfra/vec.h +++ b/src/vppinfra/vec.h @@ -320,10 +320,11 @@ _vec_resize (void **vp, uword n_add, uword hdr_sz, uword align, uword elt_sz) @param N number of elements to add @param H header size in bytes (may be zero) @param A alignment (may be zero) + @param P heap (may be zero) @return V new vector */ -#define vec_new_ha(T, N, H, A) \ - _vec_realloc (0, N, sizeof (T), H, _vec_align ((T *) 0, A), 0) +#define vec_new_generic(T, N, H, A, P) \ + _vec_realloc (0, N, sizeof (T), H, _vec_align ((T *) 0, A), P) /** \brief Create new vector of given type and length (unspecified alignment, no header). @@ -332,7 +333,7 @@ _vec_resize (void **vp, uword n_add, uword hdr_sz, uword align, uword elt_sz) @param N number of elements to add @return V new vector */ -#define vec_new(T,N) vec_new_ha(T,N,0,0) +#define vec_new(T, N) vec_new_generic (T, N, 0, 0, 0) /** \brief Create new vector of given type and length (alignment specified, no header). @@ -341,7 +342,16 @@ _vec_resize (void **vp, uword n_add, uword hdr_sz, uword align, uword elt_sz) @param A alignment (may be zero) @return V new vector */ -#define vec_new_aligned(T,N,A) vec_new_ha(T,N,0,A) +#define vec_new_aligned(T, N, A) vec_new_generic (T, N, 0, A, 0) +/** \brief Create new vector of given type and length + (heap specified, no header). + + @param T type of elements in new vector + @param N number of elements to add + @param P heap (may be zero) + @return V new vector +*/ +#define vec_new_heap(T, N, P) vec_new_generic (T, N, 0, 0, P) /** \brief Free vector's memory (no header). @param V pointer to a vector |