Skip to content

Commit

Permalink
Improve string param
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoinePrv committed Feb 2, 2024
1 parent dcefdc3 commit 0ec2ef1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
6 changes: 2 additions & 4 deletions libmamba/include/mamba/core/query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,9 @@ namespace mamba
[[nodiscard]] static auto find(MPool& pool, const std::vector<std::string>& queries)
-> QueryResult;

[[nodiscard]] static auto whoneeds(MPool& pool, const std::string& query, bool tree)
-> QueryResult;
[[nodiscard]] static auto whoneeds(MPool& pool, std::string query, bool tree) -> QueryResult;

[[nodiscard]] static auto depends(MPool& pool, const std::string& query, bool tree)
-> QueryResult;
[[nodiscard]] static auto depends(MPool& pool, std::string query, bool tree) -> QueryResult;
};

/********************
Expand Down
14 changes: 7 additions & 7 deletions libmamba/src/core/query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,15 @@ namespace mamba
};
}

auto Query::whoneeds(MPool& mpool, const std::string& query, bool tree) -> QueryResult
auto Query::whoneeds(MPool& mpool, std::string query, bool tree) -> QueryResult
{
if (tree)
{
if (auto pkg = pool_latest_package(mpool, specs::MatchSpec::parse(query)))
{
auto walker = PoolWalker(mpool);
walker.reverse_walk(std::move(pkg).value());
return { QueryType::WhoNeeds, query, std::move(walker).graph() };
return { QueryType::WhoNeeds, std::move(query), std::move(walker).graph() };
}
}
else
Expand All @@ -246,12 +246,12 @@ namespace mamba
specs::MatchSpec::parse(query),
[&](specs::PackageInfo&& pkg) { g.add_node(std::move(pkg)); }
);
return { QueryType::WhoNeeds, query, std::move(g) };
return { QueryType::WhoNeeds, std::move(query), std::move(g) };
}
return { QueryType::WhoNeeds, query, QueryResult::dependency_graph() };
return { QueryType::WhoNeeds, std::move(query), QueryResult::dependency_graph() };
}

auto Query::depends(MPool& mpool, const std::string& query, bool tree) -> QueryResult
auto Query::depends(MPool& mpool, std::string query, bool tree) -> QueryResult
{
if (auto pkg = pool_latest_package(mpool, specs::MatchSpec::parse(query)))
{
Expand All @@ -264,9 +264,9 @@ namespace mamba
{
walker.walk(std::move(pkg).value(), 1);
}
return { QueryType::Depends, query, std::move(walker).graph() };
return { QueryType::Depends, std::move(query), std::move(walker).graph() };
}
return { QueryType::Depends, query, QueryResult::dependency_graph() };
return { QueryType::Depends, std::move(query), QueryResult::dependency_graph() };
}

/********************************
Expand Down

0 comments on commit 0ec2ef1

Please sign in to comment.