Hi Xueming, On Sat, Apr 10, 2021 at 02:23:55PM +0000, Xueming Li wrote: > Adds a new function to get value of a specific key from kvargs list. > > Signed-off-by: Xueming Li <xuemi...@nvidia.com> > Reviewed-by: Gaetan Rivet <gr...@u256.net> > --- > lib/librte_kvargs/rte_kvargs.c | 20 ++++++++++++++++++++ > lib/librte_kvargs/rte_kvargs.h | 21 +++++++++++++++++++++ > lib/librte_kvargs/version.map | 3 +++ > 3 files changed, 44 insertions(+) > > diff --git a/lib/librte_kvargs/rte_kvargs.c b/lib/librte_kvargs/rte_kvargs.c > index ffae8914cf..40e7670ab3 100644 > --- a/lib/librte_kvargs/rte_kvargs.c > +++ b/lib/librte_kvargs/rte_kvargs.c > @@ -203,6 +203,26 @@ rte_kvargs_free(struct rte_kvargs *kvlist) > free(kvlist); > } > > +/* Lookup a value in an rte_kvargs list by its key. */ > +const char * > +rte_kvargs_get(const struct rte_kvargs *kvlist, const char *key) > +{ > + unsigned int i; > + > + if (!kvlist) > + return NULL; > + for (i = 0; i < kvlist->count; ++i) { > + /* Allows key to be NULL. */ > + if (!key && !kvlist->pairs[i].key) > + return kvlist->pairs[i].value;
Is it possible that kvlist->pairs[i].key == NULL? In which case? Thanks, Olivier