In rte_kvargs_process() and rte_kvargs_count(), if the key_match
argument is NULL, process all entries.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
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++;
}
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;
}
* @param kvlist
* The rte_kvargs structure
* @param key_match
- * The key on which the handler should be called
+ * The key on which the handler should be called, or NULL to process handler
+ * on all associations
* @param handler
* The function to call for each matching key
* @param opaque_arg
* @param kvlist
* The rte_kvargs structure
* @param key_match
- * The key that should match
+ * The key that should match, or NULL to count all associations
* @return
* The number of entries