From d53744b3f8a11d24aa0a75006bea53047f4e187a Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 11 Jul 2019 13:35:48 -0700 Subject: [PATCH] ircd: Rename gmatch/gequals. --- include/ircd/stringops.h | 27 ++++++++++++++------------- ircd/stringops.cc | 12 ++++++------ modules/m_room_server_acl.cc | 2 +- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/include/ircd/stringops.h b/include/ircd/stringops.h index 068d841bb..d1e83c5ad 100644 --- a/include/ircd/stringops.h +++ b/include/ircd/stringops.h @@ -22,8 +22,8 @@ namespace ircd struct iequals; // Globular ('*' and '?') expression utils. - struct gmatch; - struct gequals; + struct globular_match; + struct globular_equals; // Vintage struct strlcpy; @@ -309,7 +309,7 @@ const /// Globular equals. This allows either side of the comparison to include '*' /// and '?' characters and equality of the string expressions will be /// determined. -struct ircd::gequals +struct ircd::globular_equals { using is_transparent = std::true_type; @@ -324,18 +324,19 @@ struct ircd::gequals template - gequals(A&& a, B&& b) + globular_equals(A&& a, B&& b) :s{operator()(std::forward(a), std::forward(b))} {} - gequals() = default; + globular_equals() = default; }; -/// Globular match. Similar to gequals but only one side of the comparison is -/// considered to be the expression with '*' and '?' characters. The expression -/// string is passed at construction. The comparison inputs are treated as -/// non-expression strings. This allows for greater optimization than gequals. -struct ircd::gmatch +/// Globular match. Similar to globular_equals but only one side of the +/// comparison is considered to be the expression with '*' and '?' characters. +/// The expression string is passed at construction. The comparison inputs are +/// treated as non-expression strings. This allows for greater optimization +/// than globular_equals. +struct ircd::globular_match { string_view expr; bool s; @@ -347,17 +348,17 @@ struct ircd::gmatch bool operator()(const string_view &a) const; - gmatch(const string_view &expr) + globular_match(const string_view &expr) :expr{expr} {} template - gmatch(const string_view &expr, A&& a) + globular_match(const string_view &expr, A&& a) :expr{expr} ,s{operator()(std::forward(a))} {} - gmatch() = default; + globular_match() = default; }; inline ircd::string_view diff --git a/ircd/stringops.cc b/ircd/stringops.cc index 95208e417..8c9b59c62 100644 --- a/ircd/stringops.cc +++ b/ircd/stringops.cc @@ -44,11 +44,11 @@ ircd::replace(const string_view &s, } // -// gequals +// globular_equals // bool -ircd::gequals::operator()(const string_view &a, const string_view &b) +ircd::globular_equals::operator()(const string_view &a, const string_view &b) const { size_t ap(0), bp(0); @@ -90,14 +90,14 @@ const } // -// gmatch +// globular_match // bool -ircd::gmatch::operator()(const string_view &a) +ircd::globular_match::operator()(const string_view &a) const { //TODO: optimize. - const gequals gequals(expr, a); - return bool(gequals); + const globular_equals globular_equals(expr, a); + return bool(globular_equals); } diff --git a/modules/m_room_server_acl.cc b/modules/m_room_server_acl.cc index 0256d1380..c9bce4645 100644 --- a/modules/m_room_server_acl.cc +++ b/modules/m_room_server_acl.cc @@ -243,7 +243,7 @@ const return !for_each(prop, [&server] (const string_view &expression) { - const gmatch match + const globular_match match { expression };