mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 14:32:42 +01:00
Use TeeSink and TeeSouce in a few more places
This commit is contained in:
parent
859cd4acea
commit
85aacbee64
5 changed files with 20 additions and 21 deletions
|
|
@ -1021,11 +1021,7 @@ void LocalStore::addToStore(const ValidPathInfo & info, Source & source,
|
|||
else
|
||||
hashSink = std::make_unique<HashModuloSink>(htSHA256, std::string(info.path.hashPart()));
|
||||
|
||||
LambdaSource wrapperSource([&](unsigned char * data, size_t len) -> size_t {
|
||||
size_t n = source.read(data, len);
|
||||
(*hashSink)(data, n);
|
||||
return n;
|
||||
});
|
||||
TeeSource wrapperSource { source, *hashSink };
|
||||
|
||||
restorePath(realPath, wrapperSource);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue