about summary refs log tree commit diff
path: root/src/libstore/store-api.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2009-04-21T11·52+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2009-04-21T11·52+0000
commitd5eab2fc8293e0d14c7fd297bf7512257442295b (patch)
treeaa987c9496ee667ff59eccab1681b49b363a44cd /src/libstore/store-api.cc
parent8f1bf28505e6ba8fae35859391cbab7264b0014a (diff)
* Use foreach in a lot of places.
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r--src/libstore/store-api.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index eb75d3ada1f4..08ee922ef6a8 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -81,7 +81,7 @@ void checkStoreName(const string & name)
        reasons (e.g., "." and ".."). */
     if (string(name, 0, 1) == ".")
         throw Error(format("illegal name: `%1%'") % name);
-    for (string::const_iterator i = name.begin(); i != name.end(); ++i)
+    foreach (string::const_iterator, i, name)
         if (!((*i >= 'A' && *i <= 'Z') ||
               (*i >= 'a' && *i <= 'z') ||
               (*i >= '0' && *i <= '9') ||
@@ -207,7 +207,7 @@ Path computeStorePathForText(const string & name, const string & s,
        hacky, but we can't put them in `s' since that would be
        ambiguous. */
     string type = "text";
-    for (PathSet::const_iterator i = references.begin(); i != references.end(); ++i) {
+    foreach (PathSet::const_iterator, i, references) {
         type += ":";
         type += *i;
     }
@@ -223,7 +223,7 @@ string makeValidityRegistration(const PathSet & paths,
 {
     string s = "";
     
-    for (PathSet::iterator i = paths.begin(); i != paths.end(); ++i) {
+    foreach (PathSet::iterator, i, paths) {
         s += *i + "\n";
 
         if (showHash)
@@ -237,8 +237,7 @@ string makeValidityRegistration(const PathSet & paths,
 
         s += (format("%1%\n") % references.size()).str();
             
-        for (PathSet::iterator j = references.begin();
-             j != references.end(); ++j)
+        foreach (PathSet::iterator, j, references)
             s += *j + "\n";
     }
 
@@ -272,9 +271,7 @@ ValidPathInfo decodeValidPathInfo(std::istream & str, bool hashGiven)
 string showPaths(const PathSet & paths)
 {
     string s;
-    for (PathSet::const_iterator i = paths.begin();
-         i != paths.end(); ++i)
-    {
+    foreach (PathSet::const_iterator, i, paths) {
         if (s.size() != 0) s += ", ";
         s += "`" + *i + "'";
     }