]> git.droids-corp.org - dpdk.git/blobdiff - lib/librte_kvargs/rte_kvargs.c
kvargs: make the NULL key to match all entries
[dpdk.git] / lib / librte_kvargs / rte_kvargs.c
index c41a01688e1010e35ae728cbcd81a7e8ad32e021..a7586a31665abf4a8d829d0e803a52762aaf8658 100644 (file)
@@ -139,7 +139,7 @@ rte_kvargs_count(const struct rte_kvargs *kvlist, const char *key_match)
        ret = 0;
        for (i = 0; i < kvlist->count; i++) {
                pair = &kvlist->pairs[i];
-               if (strcmp(pair->key, key_match) == 0)
+               if (key_match == NULL || strcmp(pair->key, key_match) == 0)
                        ret++;
        }
 
@@ -160,7 +160,7 @@ rte_kvargs_process(const struct rte_kvargs *kvlist,
 
        for (i = 0; i < kvlist->count; i++) {
                pair = &kvlist->pairs[i];
-               if (strcmp(pair->key, key_match) == 0) {
+               if (key_match == NULL || strcmp(pair->key, key_match) == 0) {
                        if ((*handler)(pair->key, pair->value, opaque_arg) < 0)
                                return -1;
                }