diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-10-23T21·11+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-10-23T21·11+0000 |
commit | b2ba62170cc8359d2f8bbbd9dbacf331b98151fe (patch) | |
tree | f9617195f1462c6fd0c872ba3a5ded23b48964c3 /src/libexpr/eval.cc | |
parent | 8ac06726b92fff66714ceee8af89068ac876875a (diff) |
* Optimise string constants by putting them in the symbol table.
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r-- | src/libexpr/eval.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 72a3bf9b9c52..8c33fd22486c 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -249,6 +249,14 @@ void mkString(Value & v, const string & s, const PathSet & context) } +void mkString(Value & v, const Symbol & s) +{ + v.type = tString; + v.string.s = ((string) s).c_str(); + v.string.context = 0; +} + + void mkPath(Value & v, const char * s) { clearValue(v); @@ -429,7 +437,7 @@ void ExprInt::eval(EvalState & state, Env & env, Value & v) void ExprString::eval(EvalState & state, Env & env, Value & v) { - mkString(v, s.c_str()); + mkString(v, s); } |