From 8cf4c2c9e0b325c59c57588daf2d23013b137037 Mon Sep 17 00:00:00 2001 From: Linus Heckemann Date: Fri, 20 Dec 2024 14:02:22 +0100 Subject: [PATCH] nar-info: use string views for construction This doesn't break any usages within lix, and allows avoiding copying in some calls. The constructor already copies bits and pieces of the data passed in. Change-Id: Iea39906ca430195da4c509dd8a0a54d49b46ca4f --- lix/libstore/nar-info.cc | 2 +- lix/libstore/nar-info.hh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lix/libstore/nar-info.cc b/lix/libstore/nar-info.cc index 21166d56d..00da9ce61 100644 --- a/lix/libstore/nar-info.cc +++ b/lix/libstore/nar-info.cc @@ -4,7 +4,7 @@ namespace nix { -NarInfo::NarInfo(const Store & store, const std::string & s, const std::string & whence) +NarInfo::NarInfo(const Store & store, const std::string_view & s, const std::string_view & whence) : ValidPathInfo(StorePath(StorePath::dummy), Hash(Hash::dummy)) // FIXME: hack { unsigned line = 1; diff --git a/lix/libstore/nar-info.hh b/lix/libstore/nar-info.hh index 5f0819461..431a0c226 100644 --- a/lix/libstore/nar-info.hh +++ b/lix/libstore/nar-info.hh @@ -22,7 +22,7 @@ struct NarInfo : ValidPathInfo { } NarInfo(StorePath && path, Hash narHash) : ValidPathInfo(std::move(path), narHash) { } NarInfo(const ValidPathInfo & info) : ValidPathInfo(info) { } - NarInfo(const Store & store, const std::string & s, const std::string & whence); + NarInfo(const Store & store, const std::string_view & s, const std::string_view & whence); std::string to_string(const Store & store) const; };