| 11693 | } |
| 11694 | |
| 11695 | static int |
| 11696 | parse_name_to_index(struct context *ctx, const struct token *token, |
| 11697 | const char *str, unsigned int len, void *buf, |
| 11698 | unsigned int size, |
| 11699 | const char *const names[], size_t names_size, uint32_t *dst) |
| 11700 | { |
| 11701 | int ret; |
| 11702 | uint32_t i; |
| 11703 | |
| 11704 | RTE_SET_USED(token); |
| 11705 | RTE_SET_USED(buf); |
| 11706 | RTE_SET_USED(size); |
| 11707 | if (!ctx->object) |
| 11708 | return len; |
| 11709 | for (i = 0; i < names_size; i++) { |
| 11710 | if (!names[i]) |
| 11711 | continue; |
| 11712 | ret = strcmp_partial(names[i], str, |
| 11713 | RTE_MIN(len, strlen(names[i]))); |
| 11714 | if (!ret) { |
| 11715 | *dst = i; |
| 11716 | return len; |
| 11717 | } |
| 11718 | } |
| 11719 | return -1; |
| 11720 | } |
| 11721 | |
| 11722 | static const char *const quota_mode_names[] = { |
| 11723 | NULL, |
no test coverage detected