1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 14:21:48 +02:00

OCD: foreach -> C++11 ranged for

This commit is contained in:
Eelco Dolstra 2015-07-17 19:24:28 +02:00
parent 1511aa9f48
commit 6bd2c7bb38
30 changed files with 849 additions and 874 deletions

View file

@ -45,8 +45,8 @@ void processExpr(EvalState & state, const Strings & attrPaths,
Value vRoot;
state.eval(e, vRoot);
foreach (Strings::const_iterator, i, attrPaths) {
Value & v(*findAlongAttrPath(state, *i, autoArgs, vRoot));
for (auto & i : attrPaths) {
Value & v(*findAlongAttrPath(state, i, autoArgs, vRoot));
state.forceValue(v);
PathSet context;
@ -67,11 +67,11 @@ void processExpr(EvalState & state, const Strings & attrPaths,
} else {
DrvInfos drvs;
getDerivations(state, v, "", autoArgs, drvs, false);
foreach (DrvInfos::iterator, i, drvs) {
Path drvPath = i->queryDrvPath();
for (auto & i : drvs) {
Path drvPath = i.queryDrvPath();
/* What output do we want? */
string outputName = i->queryOutputName();
string outputName = i.queryOutputName();
if (outputName == "")
throw Error(format("derivation %1% lacks an outputName attribute ") % drvPath);
@ -168,9 +168,9 @@ int main(int argc, char * * argv)
if (attrPaths.empty()) attrPaths.push_back("");
if (findFile) {
foreach (Strings::iterator, i, files) {
Path p = state.findFile(*i);
if (p == "") throw Error(format("unable to find %1%") % *i);
for (auto & i : files) {
Path p = state.findFile(i);
if (p == "") throw Error(format("unable to find %1%") % i);
std::cout << p << std::endl;
}
return;