diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-03-04T15·49+0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-03-04T15·49+0100 |
commit | 42bc395b63260e13f42e4bf348823799e78e445f (patch) | |
tree | 282cad864de6752d4ef4a02d8c6dc92cfece223f /src/libstore/local-store.cc | |
parent | ce113c32d27a24552a6420ea0c082c6886708759 (diff) |
Eliminate some large string copying
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r-- | src/libstore/local-store.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 9a570668128e..8a2b7bb9164e 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -1415,9 +1415,9 @@ Path LocalStore::addToStore(const string & name, const Path & _srcPath, if (recursive) dumpPath(srcPath, sink, filter); else - sink.s = readFile(srcPath); + sink.s = make_ref<std::string>(readFile(srcPath)); - return addToStoreFromDump(sink.s, name, recursive, hashAlgo, repair); + return addToStoreFromDump(*sink.s, name, recursive, hashAlgo, repair); } @@ -1442,14 +1442,14 @@ Path LocalStore::addTextToStore(const string & name, const string & s, StringSink sink; dumpString(s, sink); - auto hash = hashString(htSHA256, sink.s); + auto hash = hashString(htSHA256, *sink.s); optimisePath(dstPath); ValidPathInfo info; info.path = dstPath; info.narHash = hash; - info.narSize = sink.s.size(); + info.narSize = sink.s->size(); info.references = references; registerValidPath(info); } |