fix(3p/nix/hash): smart pointers in HashSink
Change-Id: Ib2aaf42c8b234ee343c4653eb03f328c113dea86 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1492 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
This commit is contained in:
parent
e8f893ee10
commit
addcba11b0
2 changed files with 18 additions and 17 deletions
8
third_party/nix/src/libutil/hash.hh
vendored
8
third_party/nix/src/libutil/hash.hh
vendored
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue