about summary refs log tree commit diff
path: root/src/libstore/derivations.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-05-02T17·51+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-05-02T17·51+0000
commitc791e94aee07ad98ec29df18498ad85241e1e96d (patch)
treea643ba3ef9cd588792f0ca672631db0cdf3ada6c /src/libstore/derivations.cc
parentb52e71191094f564d7b7484b89e47e710bb94bdc (diff)
* Removed a bunch of ATreverses.
Diffstat (limited to 'src/libstore/derivations.cc')
-rw-r--r--src/libstore/derivations.cc35
1 files changed, 19 insertions, 16 deletions
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);
 }