Skip to content

Commit

Permalink
Delete EvalState::addToSearchPath
Browse files Browse the repository at this point in the history
This function is now trivial enough that it doesn't need to exist.

`EvalState` can still be initialized with a custom search path, but we
don't have a need to mutate the search path after it has been
constructed, and I don't see why we would need to in the future.

Fixes NixOS#8229
  • Loading branch information
Ericson2314 committed Aug 18, 2023
1 parent 665ad4f commit fe71faa
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/libexpr/eval.cc
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,9 @@ EvalState::EvalState(
/* Initialise the Nix expression search path. */
if (!evalSettings.pureEval) {
for (auto & i : _searchPath.elements)
addToSearchPath(SearchPath::Elem {i});
searchPath.elements.emplace_back(SearchPath::Elem {i});
for (auto & i : evalSettings.nixPath.get())
addToSearchPath(SearchPath::Elem::parse(i));
searchPath.elements.emplace_back(SearchPath::Elem::parse(i));
}

if (evalSettings.restrictEval || evalSettings.pureEval) {
Expand Down
2 changes: 0 additions & 2 deletions src/libexpr/eval.hh
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,6 @@ public:
std::shared_ptr<Store> buildStore = nullptr);
~EvalState();

void addToSearchPath(SearchPath::Elem && elem);

SearchPath getSearchPath() { return searchPath; }

/**
Expand Down
6 changes: 0 additions & 6 deletions src/libexpr/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -736,12 +736,6 @@ Expr * EvalState::parseStdin()
}


void EvalState::addToSearchPath(SearchPath::Elem && elem)
{
searchPath.elements.emplace_back(std::move(elem));
}


SourcePath EvalState::findFile(const std::string_view path)
{
return findFile(searchPath, path);
Expand Down

0 comments on commit fe71faa

Please sign in to comment.