about summary refs log tree commit diff
path: root/src/libexpr
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-03-07T22·55+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-03-07T22·55+0100
commit28bba8c44f484eae38e8a15dcec73cfa999156f6 (patch)
treef5e009a14192dc56a741703d08c622cf7236dc5b /src/libexpr
parent8057a192e3254c936fa0bcb5715e09600a28e8f8 (diff)
Prevent config.h from being clobbered
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/eval.cc2
-rw-r--r--src/libexpr/nixexpr.hh4
-rw-r--r--src/libexpr/parser.y6
-rw-r--r--src/libexpr/primops.cc16
4 files changed, 5 insertions, 23 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index a1613a4205b4..676dd3ac461a 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -966,7 +966,7 @@ void ExprConcatStrings::eval(EvalState & state, Env & env, Value & v)
            since paths are copied when they are used in a derivation),
            and none of the strings are allowed to have contexts. */
         if (first) {
-            isPath = !forceString && vStr.type == tPath;
+            isPath = vStr.type == tPath;
             first = false;
         }
 
diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh
index 86a7bfd506a0..bc6c3287c79d 100644
--- a/src/libexpr/nixexpr.hh
+++ b/src/libexpr/nixexpr.hh
@@ -277,10 +277,8 @@ MakeBinOp(OpConcatLists, "++")
 
 struct ExprConcatStrings : Expr
 {
-    bool forceString;
     vector<Expr *> * es;
-    ExprConcatStrings(bool forceString, vector<Expr *> * es)
-        : forceString(forceString), es(es) { };
+    ExprConcatStrings(vector<Expr *> * es) : es(es) { };
     COMMON_METHODS
 };
 
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y
index 66edfb548b32..1819da5e1caa 100644
--- a/src/libexpr/parser.y
+++ b/src/libexpr/parser.y
@@ -203,7 +203,7 @@ static Expr * stripIndentation(SymbolTable & symbols, vector<Expr *> & es)
         es2->push_back(new ExprString(symbols.create(s2)));
     }
 
-    return es2->size() == 1 ? (*es2)[0] : new ExprConcatStrings(true, es2);
+    return es2->size() == 1 ? (*es2)[0] : new ExprConcatStrings(es2);
 }
 
 
@@ -318,7 +318,7 @@ expr_op
     { vector<Expr *> * l = new vector<Expr *>;
       l->push_back($1);
       l->push_back($3);
-      $$ = new ExprConcatStrings(false, l);
+      $$ = new ExprConcatStrings(l);
     }
   | expr_op CONCAT expr_op { $$ = new ExprOpConcatLists($1, $3); }
   | expr_app
@@ -349,7 +349,7 @@ expr_simple
       /* For efficiency, and to simplify parse trees a bit. */
       if ($2->empty()) $$ = new ExprString(data->symbols.create(""));
       else if ($2->size() == 1) $$ = $2->front();
-      else $$ = new ExprConcatStrings(true, $2);
+      else $$ = new ExprConcatStrings($2);
   }
   | IND_STRING_OPEN ind_string_parts IND_STRING_CLOSE {
       $$ = stripIndentation(data->symbols, *$2);
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index f66b24b7708a..f8f893d69683 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -1107,21 +1107,6 @@ static void prim_unsafeDiscardOutputDependency(EvalState & state, Value * * args
 }
 
 
-/* Return the cryptographic hash of a string in base-16. */
-static void prim_hashString(EvalState & state, Value * * args, Value & v)
-{
-    string type = state.forceStringNoCtx(*args[0]);
-    HashType ht = parseHashType(type);
-    if (ht == htUnknown)
-      throw Error(format("unknown hash type `%1%'") % type);
-
-    PathSet context; // discarded
-    string s = state.forceString(*args[1], context);
-
-    mkString(v, printHash(hashString(ht, s)), context);
-};
-
-
 /*************************************************************
  * Versions
  *************************************************************/
@@ -1249,7 +1234,6 @@ void EvalState::createBaseEnv()
     addPrimOp("__stringLength", 1, prim_stringLength);
     addPrimOp("__unsafeDiscardStringContext", 1, prim_unsafeDiscardStringContext);
     addPrimOp("__unsafeDiscardOutputDependency", 1, prim_unsafeDiscardOutputDependency);
-    addPrimOp("__hashString", 2, prim_hashString);
 
     // Versions
     addPrimOp("__parseDrvName", 1, prim_parseDrvName);