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:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 03:50:42 +0000
commit78e9bb837c258ac0ec7712b3d612cc2f407e731e (patch)
treef515d16b6efd858a9aeb5b0ef5d6f90bf288283d /src/shared/compare-operator.c
parentAdding debian version 255.5-1. (diff)
downloadsystemd-78e9bb837c258ac0ec7712b3d612cc2f407e731e.tar.xz
systemd-78e9bb837c258ac0ec7712b3d612cc2f407e731e.zip
Merging upstream version 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;
}
}