From 78e9bb837c258ac0ec7712b3d612cc2f407e731e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 05:50:42 +0200 Subject: Merging upstream version 256. Signed-off-by: Daniel Baumann --- src/shared/compare-operator.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/shared/compare-operator.c') 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; } } -- cgit v1.2.3