diff options
author | pennae <github@quasiparticle.net> | 2022-01-21 17:55:51 +0100 |
---|---|---|
committer | pennae <github@quasiparticle.net> | 2022-01-27 17:15:43 +0100 |
commit | 0d7fae6a574ec1b6758a7e6d8e639145c1c465a9 (patch) | |
tree | fda5ab069729b9a078ca8e220d42d56515c988ec /src/libstore | |
parent | 558c4ee3e370c9f9a6ea293df54ed6914a999f1c (diff) |
convert a for more utilities to string_view
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/optimise-store.cc | 9 | ||||
-rw-r--r-- | src/libstore/parsed-derivations.cc | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc index 1833c954e..13cb142f8 100644 --- a/src/libstore/optimise-store.cc +++ b/src/libstore/optimise-store.cc @@ -26,7 +26,7 @@ static void makeWritable(const Path & path) struct MakeReadOnly { Path path; - MakeReadOnly(const Path & path) : path(path) { } + MakeReadOnly(const PathView path) : path(path) { } ~MakeReadOnly() { try { @@ -205,12 +205,13 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats, /* Make the containing directory writable, but only if it's not the store itself (we don't want or need to mess with its permissions). */ - bool mustToggle = dirOf(path) != realStoreDir.get(); - if (mustToggle) makeWritable(dirOf(path)); + const Path dirOfPath(dirOf(path)); + bool mustToggle = dirOfPath != realStoreDir.get(); + if (mustToggle) makeWritable(dirOfPath); /* When we're done, make the directory read-only again and reset its timestamp back to 0. */ - MakeReadOnly makeReadOnly(mustToggle ? dirOf(path) : ""); + MakeReadOnly makeReadOnly(mustToggle ? dirOfPath : ""); Path tempLink = (format("%1%/.tmp-link-%2%-%3%") % realStoreDir % getpid() % random()).str(); diff --git a/src/libstore/parsed-derivations.cc b/src/libstore/parsed-derivations.cc index caddba9b1..8c65053e4 100644 --- a/src/libstore/parsed-derivations.cc +++ b/src/libstore/parsed-derivations.cc @@ -170,7 +170,7 @@ std::string writeStructuredAttrsShell(const nlohmann::json & json) auto handleSimpleType = [](const nlohmann::json & value) -> std::optional<std::string> { if (value.is_string()) - return shellEscape(value); + return shellEscape(value.get<std::string_view>()); if (value.is_number()) { auto f = value.get<float>(); |