diff options
author | Kane York <kanepyork@gmail.com> | 2020-07-28T01·58-0700 |
---|---|---|
committer | kanepyork <rikingcoding@gmail.com> | 2020-07-29T06·48+0000 |
commit | addcba11b05500ba28ade309de6bd53f8153a6c4 (patch) | |
tree | 22cf6184c40eae388e0fed0eb73fa252ee9298cf /third_party/nix/src/libutil/hash.hh | |
parent | e8f893ee100e1c85e08dbfd7244e5c674266c3bc (diff) |
fix(3p/nix/hash): smart pointers in HashSink r/1506
Change-Id: Ib2aaf42c8b234ee343c4653eb03f328c113dea86 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1492 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
Diffstat (limited to 'third_party/nix/src/libutil/hash.hh')
-rw-r--r-- | third_party/nix/src/libutil/hash.hh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/third_party/nix/src/libutil/hash.hh b/third_party/nix/src/libutil/hash.hh index 0b7b11edd072..208615f67bc8 100644 --- a/third_party/nix/src/libutil/hash.hh +++ b/third_party/nix/src/libutil/hash.hh @@ -88,9 +88,11 @@ Hash hashString(HashType ht, const std::string& s); /* Compute the hash of the given file. */ Hash hashFile(HashType ht, const Path& path); +/* A pair of the Hash, and the number of bytes consumed. */ +typedef std::pair<Hash, unsigned long long> HashResult; + /* Compute the hash of the given path. The hash is defined as (essentially) hashString(ht, dumpPath(path)). */ -typedef std::pair<Hash, unsigned long long> HashResult; HashResult hashPath(HashType ht, const Path& path, PathFilter& filter = defaultPathFilter); @@ -104,12 +106,14 @@ HashType parseHashType(const std::string& s); /* And the reverse. */ std::string printHashType(HashType ht); +namespace hash { union Ctx; +} class HashSink : public BufferedSink { private: HashType ht; - Ctx* ctx; + std::unique_ptr<hash::Ctx> ctx; unsigned long long bytes; public: |