Skip to content

Commit

Permalink
Match: remove the obsolete C string overload
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Sep 1, 2024
1 parent b057f83 commit 11bdf1a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
21 changes: 0 additions & 21 deletions src/Match.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,6 @@ MatchExpression::Compile(const char *src, bool anchor) noexcept
#endif
}

bool
MatchExpression::operator()(const char *line) const noexcept
{
#ifndef HAVE_PCRE
return anchored
? strncasecmp(line, expression.data(), expression.size()) == 0
: expression.find(line) != expression.npos;
#else
assert(re != nullptr);

const auto match_data =
pcre2_match_data_create_from_pattern_8(re, nullptr);
AtScopeExit(match_data) {
pcre2_match_data_free_8(match_data);
};

return pcre2_match_8(re, (PCRE2_SPTR8)line, strlen(line),
0, 0, match_data, nullptr) >= 0;
#endif
}

bool
MatchExpression::operator()(std::string_view line) const noexcept
{
Expand Down
3 changes: 0 additions & 3 deletions src/Match.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ public:

bool Compile(const char *src, bool anchor) noexcept;

[[gnu::pure]]
bool operator()(const char *line) const noexcept;

[[gnu::pure]]
bool operator()(std::string_view line) const noexcept;
};

0 comments on commit 11bdf1a

Please sign in to comment.