Re: [vpp-dev] vec_new() vs. vec_validate()

2018-04-12 Thread John Lo (loj)
<vpp-dev@lists.fd.io> On Behalf Of Chris Luke Sent: Thursday, April 12, 2018 4:01 PM To: Bly, Mike <m...@ciena.com>; vpp-dev@lists.fd.io Subject: Re: [vpp-dev] vec_new() vs. vec_validate() Vec_new always allocates storage, vec_validate ensures that an existing allocation is at lea

Re: [vpp-dev] vec_new() vs. vec_validate()

2018-04-12 Thread Chris Luke
Vec_new always allocates storage, vec_validate ensures that an existing allocation is at least a certain size, or create a new one if the pointer is NULL. The latter is typically used when the storage will be used as an array and you want to make sure it's large enough to store element N. See