[dpdk-dev] [PATCH v4 3/5] kvargs: add get by key function

Thomas Monjalon thomas at monjalon.net
Mon Apr 12 23:18:15 CEST 2021


12/04/2021 14:07, Xueming(Steven) Li:
> From: Olivier Matz <olivier.matz at 6wind.com>
> > > +	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.

Please do explicit checks against NULL
to make clear that they are pointers, not booleans.




More information about the dev mailing list