summaryrefslogtreecommitdiff
path: root/apt-pkg/cachefilter-patterns.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2020-02-01 17:04:13 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2020-02-03 12:54:42 +0100
commitd9c4c1d88ae6c42fee0f2da3a5b9669187fc2fc5 (patch)
treec58b902c7a1680ec50ae7b6c34a63b55da1fd66a /apt-pkg/cachefilter-patterns.cc
parentbcb9ecb2cd2208d12b83c4e111be7c126b49dc7e (diff)
patterns: Use _sv literals
This will make it easier to extend those views, given that we do not need to hardcode their length.
Diffstat (limited to 'apt-pkg/cachefilter-patterns.cc')
-rw-r--r--apt-pkg/cachefilter-patterns.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/apt-pkg/cachefilter-patterns.cc b/apt-pkg/cachefilter-patterns.cc
index b21f70d6a..7abc4536d 100644
--- a/apt-pkg/cachefilter-patterns.cc
+++ b/apt-pkg/cachefilter-patterns.cc
@@ -56,10 +56,10 @@ std::unique_ptr<PatternTreeParser::Node> PatternTreeParser::parse()
// Parse a list pattern (or function call pattern)
std::unique_ptr<PatternTreeParser::Node> PatternTreeParser::parsePattern()
{
- static const APT::StringView CHARS("0123456789"
- "abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "-");
+ static constexpr auto CHARS = ("0123456789"
+ "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "-"_sv);
if (sentence[state.offset] != '?')
return nullptr;
@@ -141,8 +141,8 @@ std::unique_ptr<PatternTreeParser::Node> PatternTreeParser::parseQuotedWord()
// Parse a bare word atom
std::unique_ptr<PatternTreeParser::Node> PatternTreeParser::parseWord()
{
- static const APT::StringView DISALLOWED_START("?~,()\0", 6);
- static const APT::StringView DISALLOWED(",()\0", 4);
+ static const constexpr auto DISALLOWED_START = "?~,()\0"_sv;
+ static const constexpr auto DISALLOWED = ",()\0"_sv;
if (DISALLOWED_START.find(sentence[state.offset]) != APT::StringView::npos)
return nullptr;