> -----Original Message-----
> From: Olivier Matz <olivier.m...@6wind.com>
> Sent: Monday, April 12, 2021 2:53 PM
> To: Xueming(Steven) Li <xuemi...@nvidia.com>
> Cc: NBU-Contact-Thomas Monjalon <tho...@monjalon.net>; Gaetan Rivet
> <gaet...@nvidia.com>; dev@dpdk.org; Asaf Penso
> <as...@nvidia.com>; Ray Kinsella <m...@ashroe.eu>; Neil Horman
> <nhor...@tuxdriver.com>
> Subject: Re: [PATCH v4 3/5] kvargs: add get by key function
>
> 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?
Impossible, will remove this in next version, thanks.
>
>
> Thanks,
> Olivier