diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2011-12-02 11:47:06 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2011-12-02 11:47:06 +0000 |
commit | 49f59dceca37636353cf2f5f60135d7705ea154e (patch) | |
tree | b6b26acd615b96ed0f53089941391d6a5cad864b /src/libexpr | |
parent | b12b21825c949ef9b9327c6a0c9e2d5601aaf0b2 (diff) |
* Move parseHash16or32 into libutil, and use in nix-hash.
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/primops.cc | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 0e81f7b72..66173cdaf 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -401,17 +401,7 @@ static void prim_derivationStrict(EvalState & state, Value * * args, Value & v) HashType ht = parseHashType(outputHashAlgo); if (ht == htUnknown) throw EvalError(format("unknown hash algorithm `%1%'") % outputHashAlgo); - Hash h(ht); - if (outputHash.size() == h.hashSize * 2) - /* hexadecimal representation */ - h = parseHash(ht, outputHash); - else if (outputHash.size() == hashLength32(h)) - /* base-32 representation */ - h = parseHash32(ht, outputHash); - else - throw Error(format("hash `%1%' has wrong length for hash type `%2%'") - % outputHash % outputHashAlgo); - string s = outputHash; + Hash h = parseHash16or32(ht, outputHash); outputHash = printHash(h); if (outputHashRecursive) outputHashAlgo = "r:" + outputHashAlgo; |