aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlo Nucera <carlo.nucera@protonmail.com>2020-07-02 11:09:04 -0400
committerCarlo Nucera <carlo.nucera@protonmail.com>2020-07-02 11:09:04 -0400
commitf61bc45d192809a040a359b22f3dbd0722613af6 (patch)
treee34de33d34947ac80cb9bd87f6b608a66c745eb1 /src
parent27c8029573ab49ad11c069ef547e3c087c73939f (diff)
Get rid of the std::pair
Diffstat (limited to 'src')
-rw-r--r--src/libutil/hash.cc10
-rw-r--r--src/libutil/hash.hh2
2 files changed, 5 insertions, 7 deletions
diff --git a/src/libutil/hash.cc b/src/libutil/hash.cc
index 2908a3445..2f006ce1e 100644
--- a/src/libutil/hash.cc
+++ b/src/libutil/hash.cc
@@ -141,7 +141,7 @@ Hash Hash::fromSRI(std::string_view original) {
throw BadHash("hash '%s' is not SRI", original);
HashType parsedType = parseHashType(*hashRaw);
- return Hash(rest, std::make_pair(parsedType, true));
+ return Hash(rest, parsedType, true);
}
Hash Hash::parseAnyPrefixed(std::string_view s)
@@ -178,14 +178,12 @@ Hash Hash::parseAny(std::string_view original, std::optional<HashType> optType)
throw BadHash("hash '%s' should have type '%s'", original, printHashType(*optType));
hashType = optParsedType ? *optParsedType : *optType;
- return Hash(rest, std::make_pair(hashType, isSRI));
+ return Hash(rest, hashType, isSRI);
}
-Hash::Hash(std::string_view rest, std::pair<HashType, bool> typeAndSRI)
- : Hash(typeAndSRI.first)
+Hash::Hash(std::string_view rest, HashType type, bool isSRI)
+ : Hash(type)
{
- auto [type, isSRI] = std::move(typeAndSRI);
-
if (!isSRI && rest.size() == base16Len()) {
auto parseHexDigit = [&](char c) {
diff --git a/src/libutil/hash.hh b/src/libutil/hash.hh
index 3e413a52c..4e3591a04 100644
--- a/src/libutil/hash.hh
+++ b/src/libutil/hash.hh
@@ -49,7 +49,7 @@ struct Hash
private:
// type must be provided, s must not include <type> prefix
- Hash(std::string_view s, std::pair<HashType, bool> typeAndSRI);
+ Hash(std::string_view s, HashType type, bool isSRI);
public:
/* Check whether a hash is set. */