diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-16T18·31+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-16T18·31+0000 |
commit | 45610ae675f6f8d6ecbd48c495cb7012b143d531 (patch) | |
tree | 02728674874e94ff89148ae44111be11733f293c /src/fix-ng/primops.cc | |
parent | 3e5a019a070cbaac7d1248e208c66da9fdb23313 (diff) |
* An forward non-random access input iterator class for ATermLists.
Diffstat (limited to 'src/fix-ng/primops.cc')
-rw-r--r-- | src/fix-ng/primops.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/fix-ng/primops.cc b/src/fix-ng/primops.cc index a68352579753..86b364c30f53 100644 --- a/src/fix-ng/primops.cc +++ b/src/fix-ng/primops.cc @@ -108,11 +108,10 @@ static string processBinding(EvalState & state, Expr e, NixExpr & ne) if (atMatch(m, e) >> "List" >> es) { string s; bool first = true; - while (!ATisEmpty(es)) { + for (ATermIterator i(es); i; ++i) { startNest(nest, lvlVomit, format("processing list element")); if (!first) s = s + " "; else first = false; - s += processBinding(state, evalExpr(state, ATgetFirst(es)), ne); - es = ATgetNext(es); + s += processBinding(state, evalExpr(state, *i), ne); } return s; } @@ -140,10 +139,8 @@ Expr primDerivation(EvalState & state, Expr args) Hash outHash; bool outHashGiven = false; - for (ATermList keys = attrs.keys(); !ATisEmpty(keys); - keys = ATgetNext(keys)) - { - string key = aterm2String(ATgetFirst(keys)); + for (ATermIterator i(attrs.keys()); i; ++i) { + string key = aterm2String(*i); Expr value = attrs.get(key); startNest(nest, lvlVomit, format("processing attribute `%1%'") % key); |