On Fri, Apr 10, 2026 at 5:57 PM Lorenzo Bianconi < [email protected]> wrote:
> > Add a new iterator that allows us to pop the items as we iterate. > > We already have a wrapper for sort, add wrapper for bsearch that > > can be used later on. > > > Signed-off-by: Ales Musil <[email protected]> > > Is it better to add this function where it is actually used? Anyway, It felt a bti strange to polute the next path with it as it's quite big on it's own. > > Acked-by: Lorenzo Bianconi <[email protected]> > > > --- > > lib/vec.h | 12 ++++++++++++ > > 1 file changed, 12 insertions(+) > > > > diff --git a/lib/vec.h b/lib/vec.h > > index 5e51357de..ff8f69a5e 100644 > > --- a/lib/vec.h > > +++ b/lib/vec.h > > @@ -148,6 +148,18 @@ vector_qsort(struct vector *vec, int (*cmp)(const > void *a, const void *b)) > > } > > } > > > > +/* Binary search for given key in the vector, the vector has to be > ordered. */ > > +static inline void * > > +vector_bsearch(const struct vector *vec, const void *key, > > + int (*cmp)(const void *a, const void *b)) > > +{ > > + if (vec->len) { > > + return bsearch(key, vec->buffer, vec->len, vec->esize, cmp); > > + } > > + > > + return NULL; > > +} > > + > > /* Returns the size of allocated space for the vector elements in > bytes. */ > > static inline size_t > > vector_memory_usage(struct vector *vec) > > -- > > 2.53.0 > > > > _______________________________________________ > > dev mailing list > > [email protected] > > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > > > Thank you Lorenzo and Dumitru, applied to main. Reagrds, Ales _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
