diff options
Diffstat (limited to 'src/shared/compare-operator.c')
-rw-r--r-- | src/shared/compare-operator.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/shared/compare-operator.c b/src/shared/compare-operator.c index 0da28fc..a13db8e 100644 --- a/src/shared/compare-operator.c +++ b/src/shared/compare-operator.c @@ -6,6 +6,7 @@ #include "string-util.h" CompareOperator parse_compare_operator(const char **s, CompareOperatorParseFlags flags) { + static const struct { CompareOperator op; const char *str; @@ -40,19 +41,19 @@ CompareOperator parse_compare_operator(const char **s, CompareOperatorParseFlags * parse_compare_operator() are use on the same string? */ return _COMPARE_OPERATOR_INVALID; - for (size_t i = 0; i < ELEMENTSOF(table); i ++) { + FOREACH_ELEMENT(i, table) { const char *e; - if (table[i].need_mask != 0 && !FLAGS_SET(flags, table[i].need_mask)) + if (i->need_mask != 0 && !FLAGS_SET(flags, i->need_mask)) continue; - e = startswith(*s, table[i].str); + e = startswith(*s, i->str); if (e) { - if (table[i].valid_mask != 0 && !FLAGS_SET(flags, table[i].valid_mask)) + if (i->valid_mask != 0 && !FLAGS_SET(flags, i->valid_mask)) return _COMPARE_OPERATOR_INVALID; *s = e; - return table[i].op; + return i->op; } } |