* Return the number of times a given arg_name exists in the key/value list. * E.g. given a list = { rx = 0, rx = 1, tx = 2 } the number of args for * arg "rx" will be 2. */
| 152 | * arg "rx" will be 2. |
| 153 | */ |
| 154 | unsigned |
| 155 | rte_kvargs_count(const struct rte_kvargs *kvlist, const char *key_match) |
| 156 | { |
| 157 | const struct rte_kvargs_pair *pair; |
| 158 | unsigned i, ret; |
| 159 | |
| 160 | ret = 0; |
| 161 | for (i = 0; i < kvlist->count; i++) { |
| 162 | pair = &kvlist->pairs[i]; |
| 163 | if (key_match == NULL || strcmp(pair->key, key_match) == 0) |
| 164 | ret++; |
| 165 | } |
| 166 | |
| 167 | return ret; |
| 168 | } |
| 169 | |
| 170 | /* |
| 171 | * For each matching key, call the given handler function. |