2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 06:16:03 +00:00

parser: add an integer based rule comparison that can be used by merge

Instead of call operator< twice for merge have an integer based
comparison fn.

Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
John Johansen
2021-10-16 02:18:44 -07:00
parent b061155c9a
commit 8470760e85

View File

@@ -76,9 +76,12 @@ public:
// called by duplicate rule merge/elimination after final expand_vars
virtual bool is_mergeable(void) { return false; }
virtual bool operator<(rule_t const &rhs) const {
virtual int cmp(rule_t const &rhs) const {
return rule_type < rhs.rule_type;
}
virtual bool operator<(rule_t const &rhs) const {
return cmp(rhs) < 0;
}
virtual bool merge(rule_t &rhs __attribute__ ((unused))) { return false; };
// called late frontend to generate data for regex backend