#include <errno.h>
#include <stdbool.h>
+#define COMPARE_OPERATOR_CHARS "!<=>"
+#define COMPARE_OPERATOR_WITH_FNMATCH_CHARS COMPARE_OPERATOR_CHARS "$"
+
typedef enum CompareOperator {
/* Listed in order of checking. Note that some comparators are prefixes of others, hence the longest
* should be listed first. */
/* parse_compare_operator() needs the string to start with the comparators */
word = condition;
- r = extract_first_word(&word, &key, "!<=>$", EXTRACT_RETAIN_SEPARATORS);
+ r = extract_first_word(&word, &key, COMPARE_OPERATOR_WITH_FNMATCH_CHARS, EXTRACT_RETAIN_SEPARATORS);
if (r < 0)
return log_debug_errno(r, "Failed to parse parameter: %m");
/* The os-release spec mandates env-var-like key names */
assert(expression);
/* Parse SMBIOS field */
- r = extract_first_word(&expression, &field, "!<=>$", EXTRACT_RETAIN_SEPARATORS);
+ r = extract_first_word(&expression, &field, COMPARE_OPERATOR_WITH_FNMATCH_CHARS, EXTRACT_RETAIN_SEPARATORS);
if (r < 0)
return r;
if (r == 0 || isempty(expression))