Get rid of the std::pair
This commit is contained in:
parent
27c8029573
commit
f61bc45d19
|
@ -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) {
|
||||
|
|
|
@ -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. */
|
||||
|
|
Loading…
Reference in a new issue