* Removed a bunch of ATreverses.
This commit is contained in:
parent
b52e711910
commit
c791e94aee
2 changed files with 20 additions and 17 deletions
|
@ -218,7 +218,7 @@ Expr makeAttrs(const ATermMap & attrs)
|
||||||
abort(); /* can't happen */
|
abort(); /* can't happen */
|
||||||
bnds = ATinsert(bnds, makeBind(*i, e, pos));
|
bnds = ATinsert(bnds, makeBind(*i, e, pos));
|
||||||
}
|
}
|
||||||
return makeAttrs(ATreverse(bnds));
|
return makeAttrs(bnds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,9 @@ static void parseStrings(ATermList paths, StringSet & out, bool arePaths)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Shut up warnings. */
|
||||||
|
void throwBadDrv(ATerm t) __attribute__ ((noreturn));
|
||||||
|
|
||||||
void throwBadDrv(ATerm t)
|
void throwBadDrv(ATerm t)
|
||||||
{
|
{
|
||||||
throw badTerm("not a valid derivation", t);
|
throw badTerm("not a valid derivation", t);
|
||||||
|
@ -110,18 +113,18 @@ Derivation parseDerivation(ATerm t)
|
||||||
static ATermList unparseStrings(const StringSet & paths)
|
static ATermList unparseStrings(const StringSet & paths)
|
||||||
{
|
{
|
||||||
ATermList l = ATempty;
|
ATermList l = ATempty;
|
||||||
for (PathSet::const_iterator i = paths.begin();
|
for (PathSet::const_reverse_iterator i = paths.rbegin();
|
||||||
i != paths.end(); ++i)
|
i != paths.rend(); ++i)
|
||||||
l = ATinsert(l, toATerm(*i));
|
l = ATinsert(l, toATerm(*i));
|
||||||
return ATreverse(l);
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ATerm unparseDerivation(const Derivation & drv)
|
ATerm unparseDerivation(const Derivation & drv)
|
||||||
{
|
{
|
||||||
ATermList outputs = ATempty;
|
ATermList outputs = ATempty;
|
||||||
for (DerivationOutputs::const_iterator i = drv.outputs.begin();
|
for (DerivationOutputs::const_reverse_iterator i = drv.outputs.rbegin();
|
||||||
i != drv.outputs.end(); ++i)
|
i != drv.outputs.rend(); ++i)
|
||||||
outputs = ATinsert(outputs,
|
outputs = ATinsert(outputs,
|
||||||
makeDerivationOutput(
|
makeDerivationOutput(
|
||||||
toATerm(i->first),
|
toATerm(i->first),
|
||||||
|
@ -130,34 +133,34 @@ ATerm unparseDerivation(const Derivation & drv)
|
||||||
toATerm(i->second.hash)));
|
toATerm(i->second.hash)));
|
||||||
|
|
||||||
ATermList inDrvs = ATempty;
|
ATermList inDrvs = ATempty;
|
||||||
for (DerivationInputs::const_iterator i = drv.inputDrvs.begin();
|
for (DerivationInputs::const_reverse_iterator i = drv.inputDrvs.rbegin();
|
||||||
i != drv.inputDrvs.end(); ++i)
|
i != drv.inputDrvs.rend(); ++i)
|
||||||
inDrvs = ATinsert(inDrvs,
|
inDrvs = ATinsert(inDrvs,
|
||||||
makeDerivationInput(
|
makeDerivationInput(
|
||||||
toATerm(i->first),
|
toATerm(i->first),
|
||||||
unparseStrings(i->second)));
|
unparseStrings(i->second)));
|
||||||
|
|
||||||
ATermList args = ATempty;
|
ATermList args = ATempty;
|
||||||
for (Strings::const_iterator i = drv.args.begin();
|
for (Strings::const_reverse_iterator i = drv.args.rbegin();
|
||||||
i != drv.args.end(); ++i)
|
i != drv.args.rend(); ++i)
|
||||||
args = ATinsert(args, toATerm(*i));
|
args = ATinsert(args, toATerm(*i));
|
||||||
|
|
||||||
ATermList env = ATempty;
|
ATermList env = ATempty;
|
||||||
for (StringPairs::const_iterator i = drv.env.begin();
|
for (StringPairs::const_reverse_iterator i = drv.env.rbegin();
|
||||||
i != drv.env.end(); ++i)
|
i != drv.env.rend(); ++i)
|
||||||
env = ATinsert(env,
|
env = ATinsert(env,
|
||||||
makeEnvBinding(
|
makeEnvBinding(
|
||||||
toATerm(i->first),
|
toATerm(i->first),
|
||||||
toATerm(i->second)));
|
toATerm(i->second)));
|
||||||
|
|
||||||
return makeDerive(
|
return makeDerive(
|
||||||
ATreverse(outputs),
|
outputs,
|
||||||
ATreverse(inDrvs),
|
inDrvs,
|
||||||
unparseStrings(drv.inputSrcs),
|
unparseStrings(drv.inputSrcs),
|
||||||
toATerm(drv.platform),
|
toATerm(drv.platform),
|
||||||
toATerm(drv.builder),
|
toATerm(drv.builder),
|
||||||
ATreverse(args),
|
args,
|
||||||
ATreverse(env));
|
env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue