1616namespace brave_etld {
1717namespace internal {
1818
19- const PublicSuffixRule * PublicSuffixRule::root_rule = new PublicSuffixRule(" *" );
19+ const PublicSuffixRule* PublicSuffixRule::root_rule = new PublicSuffixRule(" *" );
2020
21- std::vector<Label> parse_labels (const std::string & label_text) {
21+ std::vector<Label> parse_labels (const std::string& label_text) {
2222 std::vector<Label> labels;
2323 size_t previous = 0 ;
2424 size_t current = label_text.find (" ." );
@@ -61,12 +61,12 @@ std::string trim_to_whitespace(std::string const& str) {
6161
6262PublicSuffixRule::PublicSuffixRule () {}
6363
64- PublicSuffixRule::PublicSuffixRule (const PublicSuffixRule & rule) :
64+ PublicSuffixRule::PublicSuffixRule (const PublicSuffixRule& rule) :
6565 labels_ (rule.labels_),
6666 is_exception_ (rule.IsException()),
6767 is_wildcard_ (rule.IsWildcard()) {}
6868
69- PublicSuffixRule::PublicSuffixRule (const std::string & rule_text) {
69+ PublicSuffixRule::PublicSuffixRule (const std::string& rule_text) {
7070 std::string trimmed_rule_text (trim_to_whitespace (rule_text));
7171 if (trimmed_rule_text.length () == 0 ) {
7272 throw PublicSuffixRuleInputException (
@@ -97,7 +97,7 @@ PublicSuffixRule::PublicSuffixRule(const std::string &rule_text) {
9797 labels_ = parse_labels (labels_view);
9898}
9999
100- PublicSuffixRule::PublicSuffixRule (const std::vector<Label> & labels,
100+ PublicSuffixRule::PublicSuffixRule (const std::vector<Label>& labels,
101101 bool is_exception, bool is_wildcard) :
102102 labels_ (labels),
103103 is_exception_ (is_exception),
@@ -129,7 +129,7 @@ SerializationResult PublicSuffixRule::Serialize() const {
129129 };
130130}
131131
132- bool PublicSuffixRule::Equals (const PublicSuffixRule & rule) const {
132+ bool PublicSuffixRule::Equals (const PublicSuffixRule& rule) const {
133133 return (
134134 labels_ == rule.labels_ &&
135135 is_exception_ == rule.IsException () &&
@@ -138,7 +138,7 @@ bool PublicSuffixRule::Equals(const PublicSuffixRule &rule) const {
138138
139139// Implements matching algoritms described here
140140// https://publicsuffix.org/list/
141- bool PublicSuffixRule::Matches (const Domain & domain) const {
141+ bool PublicSuffixRule::Matches (const Domain& domain) const {
142142 // When the domain and rule are split into corresponding labels, that the
143143 // domain contains as many or more labels than the rule.
144144 const size_t num_rule_labels = labels_.size ();
@@ -166,8 +166,8 @@ bool PublicSuffixRule::Matches(const Domain &domain) const {
166166 return true ;
167167}
168168
169- DomainInfo PublicSuffixRule::Apply (const Domain & domain) const {
170- auto domain_len = domain.Length ();
169+ DomainInfo PublicSuffixRule::Apply (const Domain& domain) const {
170+ const auto domain_len = domain.Length ();
171171 auto rule_len = Length ();
172172 if (IsException ()) {
173173 rule_len -= 1 ;
@@ -249,7 +249,7 @@ std::string PublicSuffixRule::ToString() const {
249249 return as_string.str ();
250250}
251251
252- PublicSuffixRule rule_from_serialization (const SerializedBuffer & buffer) {
252+ PublicSuffixRule rule_from_serialization (const SerializedBuffer& buffer) {
253253 const SerializedBufferInfo info = extract_buffer_info (buffer);
254254 const std::string body_str = buffer.substr (info.body_start , info.body_len );
255255 bool is_exception = body_str[0 ] == ' t' ;
0 commit comments