aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/store-api.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-06 12:24:20 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-06 12:24:20 -0500
commit6a168254ce068c067259c913ee7d6ee2e0d1dc7e (patch)
tree7fd9315876cdca5224a978cba8b0a792bbd6710d /src/libstore/store-api.cc
parent8623143921f8683b88d46aaebe9f707e5b9a912b (diff)
Use named field initialization for references
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r--src/libstore/store-api.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 592afebd8..4b89465e7 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -232,7 +232,7 @@ std::pair<StorePath, Hash> Store::computeStorePathForPath(std::string_view name,
.method = method,
.hash = h,
},
- {},
+ .references = {},
};
return std::make_pair(makeFixedOutputPath(name, caInfo), h);
}
@@ -442,7 +442,7 @@ ValidPathInfo Store::addToStoreSlow(std::string_view name, const Path & srcPath,
.method = method,
.hash = hash,
},
- {},
+ .references = {},
},
},
narHash,
@@ -1270,16 +1270,18 @@ std::optional<StorePathDescriptor> ValidPathInfo::fullStorePathDescriptorOpt() c
return StorePathDescriptor {
.name = std::string { path.name() },
.info = std::visit(overloaded {
- [&](const TextHash & th) {
- TextInfo info { th };
+ [&](const TextHash & th) -> ContentAddressWithReferences {
assert(!hasSelfReference);
- info.references = references;
- return ContentAddressWithReferences { info };
+ return TextInfo {
+ th,
+ .references = references,
+ };
},
- [&](const FixedOutputHash & foh) {
- FixedOutputInfo info { foh };
- info.references = static_cast<PathReferences<StorePath>>(*this);
- return ContentAddressWithReferences { info };
+ [&](const FixedOutputHash & foh) -> ContentAddressWithReferences {
+ return FixedOutputInfo {
+ foh,
+ .references = static_cast<PathReferences<StorePath>>(*this),
+ };
},
}, *ca),
};