aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
diff options
context:
space:
mode:
authorCarlo Nucera <carlo.nucera@protonmail.com>2020-08-05 15:11:49 -0400
committerCarlo Nucera <carlo.nucera@protonmail.com>2020-08-05 15:11:49 -0400
commit1ad6394b33b5e627c27bc26247f8a5e1d7d81ce1 (patch)
treec93ba7a8b1a5b7ddeadda1f2982a0dbfa0826783 /src/libutil
parent1d71028f4d43f8e3ade559f7187f697c7bb9d709 (diff)
Add Hash::dummy to signal default value
We did this in the same spirit of the dummy value that's present in libstore/path.hh
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/hash.cc2
-rw-r--r--src/libutil/hash.hh2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/libutil/hash.cc b/src/libutil/hash.cc
index dfb3668f1..4a94f0dfd 100644
--- a/src/libutil/hash.cc
+++ b/src/libutil/hash.cc
@@ -136,6 +136,8 @@ std::string Hash::to_string(Base base, bool includeType) const
return s;
}
+Hash Hash::dummy(htSHA256);
+
Hash Hash::parseSRI(std::string_view original) {
auto rest = original;
diff --git a/src/libutil/hash.hh b/src/libutil/hash.hh
index 00ce7bb6f..0520c6022 100644
--- a/src/libutil/hash.hh
+++ b/src/libutil/hash.hh
@@ -105,6 +105,8 @@ public:
assert(type == htSHA1);
return std::string(to_string(Base16, false), 0, 7);
}
+
+ static Hash dummy;
};
/* Helper that defaults empty hashes to the 0 hash. */