aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2017-11-02 19:28:09 -0400
committerDave Barach <openvpp@barachs.net>2017-11-08 12:23:00 +0000
commit5ed8774529147ec9a103aaf48d4a708a287a2f2a (patch)
tree3282baf38e9834518cb85218292ce10d61a2119f
parentc97b4aca0db8d84b17ceb03a14ab44346a2b3466 (diff)
vppinfra: make _vec_resize_will_expand read-only
Change-Id: Ibcc20c24f6feb2b91245b0d88830a6c730d704e6 Signed-off-by: Florin Coras <fcoras@cisco.com> (cherry picked from commit ef5d5aa2f168d7964076bcf74b0da249b3e0cd23)
-rw-r--r--src/vppinfra/vec.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/vppinfra/vec.h b/src/vppinfra/vec.h
index de90abf0..e2cb24c5 100644
--- a/src/vppinfra/vec.h
+++ b/src/vppinfra/vec.h
@@ -145,14 +145,14 @@ _vec_resize (void *v,
data_align));
}
-/** \brief Low-level vector resize predicate
+/** \brief Determine if vector will resize with next allocation
@param v pointer to a vector
@param length_increment length increment in elements
@param data_bytes requested size in bytes
@param header_bytes header size in bytes (may be zero)
@param data_align alignment (may be zero)
- @return v_prime pointer to resized vector, may or may not equal v
+ @return 1 if vector will resize 0 otherwise
*/
always_inline int
@@ -161,7 +161,6 @@ _vec_resize_will_expand (void *v,
uword data_bytes, uword header_bytes,
uword data_align)
{
- vec_header_t *vh = _vec_find (v);
uword new_data_bytes, aligned_header_bytes;
aligned_header_bytes = vec_header_bytes (header_bytes);
@@ -177,10 +176,7 @@ _vec_resize_will_expand (void *v,
/* Typically we'll not need to resize. */
if (new_data_bytes <= clib_mem_size (p))
- {
- vh->len += length_increment;
- return 0;
- }
+ return 0;
}
return 1;
}