about summary refs log tree commit diff
path: root/src/nix-hash/nix-hash.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2011-12-02T11·47+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2011-12-02T11·47+0000
commit49f59dceca37636353cf2f5f60135d7705ea154e (patch)
treeb6b26acd615b96ed0f53089941391d6a5cad864b /src/nix-hash/nix-hash.cc
parentb12b21825c949ef9b9327c6a0c9e2d5601aaf0b2 (diff)
* Move parseHash16or32 into libutil, and use in nix-hash.
Diffstat (limited to 'src/nix-hash/nix-hash.cc')
-rw-r--r--src/nix-hash/nix-hash.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nix-hash/nix-hash.cc b/src/nix-hash/nix-hash.cc
index 4867234bffc1..5b35ccd9dae3 100644
--- a/src/nix-hash/nix-hash.cc
+++ b/src/nix-hash/nix-hash.cc
@@ -43,7 +43,7 @@ void run(Strings args)
     }
 
     if (op == opHash) {
-        for (Strings::iterator i = ss.begin(); i != ss.end(); ++i) {
+        foreach (Strings::iterator, i, ss) {
             Hash h = flat ? hashFile(ht, *i) : hashPath(ht, *i).first;
             if (truncate && h.hashSize > 20) h = compressHash(h, 20);
             std::cout << format("%1%\n") %
@@ -52,8 +52,8 @@ void run(Strings args)
     }
 
     else {
-        for (Strings::iterator i = ss.begin(); i != ss.end(); ++i) {
-            Hash h = op == opTo16 ? parseHash32(ht, *i) : parseHash(ht, *i);
+        foreach (Strings::iterator, i, ss) {
+            Hash h = parseHash16or32(ht, *i);
             std::cout << format("%1%\n") %
                 (op == opTo16 ? printHash(h) : printHash32(h));
         }