summaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/hash.c2
-rw-r--r--src/vppinfra/heap.h2
-rw-r--r--src/vppinfra/serialize.c5
-rw-r--r--src/vppinfra/sparse_vec.h2
-rw-r--r--src/vppinfra/vec.h9
5 files changed, 12 insertions, 8 deletions
diff --git a/src/vppinfra/hash.c b/src/vppinfra/hash.c
index 121fa385705..79103b6d3f4 100644
--- a/src/vppinfra/hash.c
+++ b/src/vppinfra/hash.c
@@ -685,7 +685,7 @@ _hash_create (uword elts, hash_t * h_user)
if (h_user)
log2_pair_size = h_user->log2_pair_size;
- v = _vec_resize (0,
+ v = _vec_resize ((void *) 0,
/* vec len: */ elts,
/* data bytes: */
(elts << log2_pair_size) * sizeof (hash_pair_t),
diff --git a/src/vppinfra/heap.h b/src/vppinfra/heap.h
index 8c1aae46ebf..70e34cb4eb3 100644
--- a/src/vppinfra/heap.h
+++ b/src/vppinfra/heap.h
@@ -220,7 +220,7 @@ uword heap_bytes (void *v);
always_inline void *
_heap_new (u32 len, u32 n_elt_bytes)
{
- void *v = _vec_resize (0, len, (uword) len * n_elt_bytes,
+ void *v = _vec_resize ((void *) 0, len, (uword) len * n_elt_bytes,
sizeof (heap_header_t),
HEAP_DATA_ALIGN);
heap_header (v)->elt_bytes = n_elt_bytes;
diff --git a/src/vppinfra/serialize.c b/src/vppinfra/serialize.c
index fe2146a1e64..a098aa2d98a 100644
--- a/src/vppinfra/serialize.c
+++ b/src/vppinfra/serialize.c
@@ -313,7 +313,7 @@ unserialize_vector_ha (serialize_main_t * m,
if (l > max_length)
serialize_error (&m->header,
clib_error_create ("bad vector length %d", l));
- p = v = _vec_resize (0, l, (uword) l * elt_bytes, header_bytes,
+ p = v = _vec_resize ((void *) 0, l, (uword) l * elt_bytes, header_bytes,
/* align */ align);
while (l != 0)
@@ -444,7 +444,8 @@ unserialize_pool_helper (serialize_main_t * m,
return 0;
}
- v = _vec_resize (0, l, (uword) l * elt_bytes, sizeof (p[0]), align);
+ v = _vec_resize ((void *) 0, l, (uword) l * elt_bytes, sizeof (p[0]),
+ align);
p = pool_header (v);
vec_unserialize (m, &p->free_indices, unserialize_vec_32);
diff --git a/src/vppinfra/sparse_vec.h b/src/vppinfra/sparse_vec.h
index ec8f0a1c4bf..0da154d8b68 100644
--- a/src/vppinfra/sparse_vec.h
+++ b/src/vppinfra/sparse_vec.h
@@ -76,7 +76,7 @@ sparse_vec_new (uword elt_bytes, uword sparse_index_bits)
ASSERT (sparse_index_bits <= 16);
- v = _vec_resize (0,
+ v = _vec_resize ((void *) 0,
/* length increment */ 8,
/* data bytes */ 8 * elt_bytes,
/* header bytes */ sizeof (h[0]),
diff --git a/src/vppinfra/vec.h b/src/vppinfra/vec.h
index a029630559c..f233ae1c48f 100644
--- a/src/vppinfra/vec.h
+++ b/src/vppinfra/vec.h
@@ -111,10 +111,13 @@ void *vec_resize_allocate_memory (void *v,
@return v_prime pointer to resized vector, may or may not equal v
*/
+#define _vec_resize(V,L,DB,HB,A) \
+ _vec_resize_inline(V,L,DB,HB,clib_max((__alignof__((V)[0])),(A)))
+
always_inline void *
-_vec_resize (void *v,
- word length_increment,
- uword data_bytes, uword header_bytes, uword data_align)
+_vec_resize_inline (void *v,
+ word length_increment,
+ uword data_bytes, uword header_bytes, uword data_align)
{
vec_header_t *vh = _vec_find (v);
uword new_data_bytes, aligned_header_bytes;