summaryrefslogtreecommitdiffstats
path: root/src/shared/compare-operator.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 03:50:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 03:50:40 +0000
commitfc53809803cd2bc2434e312b19a18fa36776da12 (patch)
treeb4b43bd6538f51965ce32856e9c053d0f90919c8 /src/shared/compare-operator.c
parentAdding upstream version 255.5. (diff)
downloadsystemd-fc53809803cd2bc2434e312b19a18fa36776da12.tar.xz
systemd-fc53809803cd2bc2434e312b19a18fa36776da12.zip
Adding upstream version 256.upstream/256
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/shared/compare-operator.c')
-rw-r--r--src/shared/compare-operator.c11
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;
}
}