diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-05-02T17·51+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-05-02T17·51+0000 |
commit | c791e94aee07ad98ec29df18498ad85241e1e96d (patch) | |
tree | a643ba3ef9cd588792f0ca672631db0cdf3ada6c | |
parent | b52e71191094f564d7b7484b89e47e710bb94bdc (diff) |
* Removed a bunch of ATreverses.
-rw-r--r-- | src/libexpr/nixexpr.cc | 2 | ||||
-rw-r--r-- | src/libstore/derivations.cc | 35 |
2 files changed, 20 insertions, 17 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index f88e28289047..3adba1e2ed41 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -218,7 +218,7 @@ Expr makeAttrs(const ATermMap & attrs) abort(); /* can't happen */ bnds = ATinsert(bnds, makeBind(*i, e, pos)); } - return makeAttrs(ATreverse(bnds)); + return makeAttrs(bnds); } diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc index e31333e777b1..e2d81bda83e7 100644 --- a/src/libstore/derivations.cc +++ b/src/libstore/derivations.cc @@ -46,7 +46,10 @@ static void parseStrings(ATermList paths, StringSet & out, bool arePaths) } -void throwBadDrv(ATerm t) +/* Shut up warnings. */ +void throwBadDrv(ATerm t) __attribute__ ((noreturn)); + +void throwBadDrv(ATerm t) { throw badTerm("not a valid derivation", t); } @@ -110,18 +113,18 @@ Derivation parseDerivation(ATerm t) static ATermList unparseStrings(const StringSet & paths) { ATermList l = ATempty; - for (PathSet::const_iterator i = paths.begin(); - i != paths.end(); ++i) + for (PathSet::const_reverse_iterator i = paths.rbegin(); + i != paths.rend(); ++i) l = ATinsert(l, toATerm(*i)); - return ATreverse(l); + return l; } ATerm unparseDerivation(const Derivation & drv) { ATermList outputs = ATempty; - for (DerivationOutputs::const_iterator i = drv.outputs.begin(); - i != drv.outputs.end(); ++i) + for (DerivationOutputs::const_reverse_iterator i = drv.outputs.rbegin(); + i != drv.outputs.rend(); ++i) outputs = ATinsert(outputs, makeDerivationOutput( toATerm(i->first), @@ -130,34 +133,34 @@ ATerm unparseDerivation(const Derivation & drv) toATerm(i->second.hash))); ATermList inDrvs = ATempty; - for (DerivationInputs::const_iterator i = drv.inputDrvs.begin(); - i != drv.inputDrvs.end(); ++i) + for (DerivationInputs::const_reverse_iterator i = drv.inputDrvs.rbegin(); + i != drv.inputDrvs.rend(); ++i) inDrvs = ATinsert(inDrvs, makeDerivationInput( toATerm(i->first), unparseStrings(i->second))); ATermList args = ATempty; - for (Strings::const_iterator i = drv.args.begin(); - i != drv.args.end(); ++i) + for (Strings::const_reverse_iterator i = drv.args.rbegin(); + i != drv.args.rend(); ++i) args = ATinsert(args, toATerm(*i)); ATermList env = ATempty; - for (StringPairs::const_iterator i = drv.env.begin(); - i != drv.env.end(); ++i) + for (StringPairs::const_reverse_iterator i = drv.env.rbegin(); + i != drv.env.rend(); ++i) env = ATinsert(env, makeEnvBinding( toATerm(i->first), toATerm(i->second))); return makeDerive( - ATreverse(outputs), - ATreverse(inDrvs), + outputs, + inDrvs, unparseStrings(drv.inputSrcs), toATerm(drv.platform), toATerm(drv.builder), - ATreverse(args), - ATreverse(env)); + args, + env); } |