Hi Mark,
Sort of nitpicking but looks like making id_pool_find() public would be better because I don't know what is being checked in the new function. The new function is a simple wrapper around _find() and to me either _find() or _lookup() names translate better to what is being done. What do you think? fbl On Fri, Aug 28, 2020 at 06:03:03PM +0100, Mark Gray wrote: > Signed-off-by: Mark Gray <[email protected]> > --- > lib/id-pool.c | 10 ++++++++++ > lib/id-pool.h | 1 + > 2 files changed, 11 insertions(+) > > diff --git a/lib/id-pool.c b/lib/id-pool.c > index 69910ad08..2b085db64 100644 > --- a/lib/id-pool.c > +++ b/lib/id-pool.c > @@ -93,6 +93,16 @@ id_pool_find(struct id_pool *pool, uint32_t id) > return NULL; > } > > +bool > +id_pool_check(struct id_pool *pool, uint32_t id) > +{ > + if (!id_pool_find(pool, id)) { > + return false; > + } > + > + return true; > +} > + > void > id_pool_add(struct id_pool *pool, uint32_t id) > { > diff --git a/lib/id-pool.h b/lib/id-pool.h > index 8721f8793..6b642e4ff 100644 > --- a/lib/id-pool.h > +++ b/lib/id-pool.h > @@ -29,6 +29,7 @@ void id_pool_destroy(struct id_pool *); > bool id_pool_alloc_id(struct id_pool *, uint32_t *id); > void id_pool_free_id(struct id_pool *, uint32_t id); > void id_pool_add(struct id_pool *, uint32_t id); > +bool id_pool_check(struct id_pool *, uint32_t id); > > /* > * ID pool. > -- > 2.26.2 > > _______________________________________________ > dev mailing list > [email protected] > https://mail.openvswitch.org/mailman/listinfo/ovs-dev -- fbl _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
