mirror of
https://github.com/NixOS/nix
synced 2025-06-25 19:01:16 +02:00
Fix signed vs. unsigned comparison warning and improve code
This commit is contained in:
parent
f269911641
commit
eaced12c94
1 changed files with 13 additions and 9 deletions
|
@ -174,15 +174,19 @@ void builtinBuildenv(const BasicDerivation & drv)
|
||||||
/* Convert the stuff we get from the environment back into a
|
/* Convert the stuff we get from the environment back into a
|
||||||
* coherent data type. */
|
* coherent data type. */
|
||||||
Packages pkgs;
|
Packages pkgs;
|
||||||
auto derivations = tokenizeString<Strings>(getAttr("derivations"));
|
{
|
||||||
while (!derivations.empty()) {
|
auto derivations = tokenizeString<Strings>(getAttr("derivations"));
|
||||||
/* !!! We're trusting the caller to structure derivations env var correctly */
|
|
||||||
auto active = derivations.front(); derivations.pop_front();
|
auto itemIt = derivations.begin();
|
||||||
auto priority = stoi(derivations.front()); derivations.pop_front();
|
while (itemIt != derivations.end()) {
|
||||||
auto outputs = stoi(derivations.front()); derivations.pop_front();
|
/* !!! We're trusting the caller to structure derivations env var correctly */
|
||||||
for (auto n = 0; n < outputs; n++) {
|
const bool active = "false" != *itemIt++;
|
||||||
auto path = derivations.front(); derivations.pop_front();
|
const int priority = stoi(*itemIt++);
|
||||||
pkgs.emplace_back(path, active != "false", priority);
|
const size_t outputs = stoul(*itemIt++);
|
||||||
|
|
||||||
|
for (size_t n {0}; n < outputs; n++) {
|
||||||
|
pkgs.emplace_back(std::move(*itemIt++), active, priority);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue