mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-27 08:16:14 +02:00
Inline Hash::init()
This commit is contained in:
parent
d63a5ded76
commit
c8c4bcf90e
2 changed files with 2 additions and 4 deletions
|
@ -27,7 +27,7 @@ static size_t regularHashSize(HashType type) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hash::init()
|
Hash::Hash(HashType type) : type(type)
|
||||||
{
|
{
|
||||||
hashSize = regularHashSize(type);
|
hashSize = regularHashSize(type);
|
||||||
assert(hashSize <= maxHashSize);
|
assert(hashSize <= maxHashSize);
|
||||||
|
|
|
@ -32,7 +32,7 @@ struct Hash
|
||||||
HashType type;
|
HashType type;
|
||||||
|
|
||||||
/* Create a zero-filled hash object. */
|
/* Create a zero-filled hash object. */
|
||||||
Hash(HashType type) : type(type) { init(); };
|
Hash(HashType type);
|
||||||
|
|
||||||
/* Initialize the hash from a string representation, in the format
|
/* Initialize the hash from a string representation, in the format
|
||||||
"[<type>:]<base16|base32|base64>" or "<type>-<base64>" (a
|
"[<type>:]<base16|base32|base64>" or "<type>-<base64>" (a
|
||||||
|
@ -49,8 +49,6 @@ private:
|
||||||
// type must be provided, s must not include <type> prefix
|
// 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, std::pair<HashType, bool> typeAndSRI);
|
||||||
|
|
||||||
void init();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* Check whether a hash is set. */
|
/* Check whether a hash is set. */
|
||||||
operator bool () const { return (bool) type; }
|
operator bool () const { return (bool) type; }
|
||||||
|
|
Loading…
Reference in a new issue