aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/attr-path.cc
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2022-01-21 14:44:00 +0100
committerpennae <github@quasiparticle.net>2022-01-27 17:15:43 +0100
commit41d70a2fc8d243d8c83ecc1c9ba648b625957437 (patch)
treea85c0c1971926fd8cf645f4ccf13547e2576a677 /src/libexpr/attr-path.cc
parent0d7fae6a574ec1b6758a7e6d8e639145c1c465a9 (diff)
return string_views from forceString*
once a string has been forced we already have dynamic storage allocated for it, so we can easily reuse that storage instead of copying.
Diffstat (limited to 'src/libexpr/attr-path.cc')
-rw-r--r--src/libexpr/attr-path.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libexpr/attr-path.cc b/src/libexpr/attr-path.cc
index c50c6d92b..edef4d9f8 100644
--- a/src/libexpr/attr-path.cc
+++ b/src/libexpr/attr-path.cc
@@ -121,7 +121,7 @@ Pos findPackageFilename(EvalState & state, Value & v, std::string what)
std::string filename(pos, 0, colon);
unsigned int lineno;
try {
- lineno = std::stoi(std::string(pos, colon + 1));
+ lineno = std::stoi(std::string(pos, colon + 1, string::npos));
} catch (std::invalid_argument & e) {
throw ParseError("cannot parse line number '%s'", pos);
}