diff --git a/src/nix/diff-closures.cc b/src/nix/diff-closures.cc index 46c94b211..2bc7fe82b 100644 --- a/src/nix/diff-closures.cc +++ b/src/nix/diff-closures.cc @@ -25,15 +25,17 @@ GroupedPaths getClosureInfo(ref store, const StorePath & toplevel) GroupedPaths groupedPaths; - for (auto & path : closure) { + for (auto const & path : closure) { /* Strip the output name. Unfortunately this is ambiguous (we can't distinguish between output names like "bin" and version suffixes like "unstable"). */ static std::regex regex("(.*)-([a-z]+|lib32|lib64)"); - std::smatch match; - std::string name(path.name()); + std::cmatch match; + std::string name{path.name()}; + std::string_view const origName = path.name(); std::string outputName; - if (std::regex_match(name, match, regex)) { + + if (std::regex_match(origName.begin(), origName.end(), match, regex)) { name = match[1]; outputName = match[2]; }