kvargs: fix processing a null list
In the doxygen description of rte_kvargs_process(), it is said:
If *kvlist* is NULL function does nothing.
It has been added by mistake here instead of rte_kvargs_free().
Anyway, null list should be correctly handled in both functions.
Comments are fixed in both functions and NULL handling is added
to rte_kvargs_process().
Fixes: c34af7424e
("kvargs: fix freeing behaviour for null")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
parent
198b66b946
commit
25495407cb
@ -120,6 +120,9 @@ rte_kvargs_process(const struct rte_kvargs *kvlist,
|
||||
const struct rte_kvargs_pair *pair;
|
||||
unsigned i;
|
||||
|
||||
if (kvlist == NULL)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < kvlist->count; i++) {
|
||||
pair = &kvlist->pairs[i];
|
||||
if (key_match == NULL || strcmp(pair->key, key_match) == 0) {
|
||||
|
@ -110,7 +110,7 @@ struct rte_kvargs *rte_kvargs_parse_delim(const char *args,
|
||||
* rte_kvargs_parse().
|
||||
*
|
||||
* @param kvlist
|
||||
* The rte_kvargs structure
|
||||
* The rte_kvargs structure. No error if NULL.
|
||||
*/
|
||||
void rte_kvargs_free(struct rte_kvargs *kvlist);
|
||||
|
||||
@ -119,11 +119,10 @@ void rte_kvargs_free(struct rte_kvargs *kvlist);
|
||||
*
|
||||
* For each key/value association that matches the given key, calls the
|
||||
* handler function with the for a given arg_name passing the value on the
|
||||
* dictionary for that key and a given extra argument. If *kvlist* is NULL
|
||||
* function does nothing.
|
||||
* dictionary for that key and a given extra argument.
|
||||
*
|
||||
* @param kvlist
|
||||
* The rte_kvargs structure
|
||||
* The rte_kvargs structure. No error if NULL.
|
||||
* @param key_match
|
||||
* The key on which the handler should be called, or NULL to process handler
|
||||
* on all associations
|
||||
|
Loading…
Reference in New Issue
Block a user