1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 11:41:15 +02:00

* Optimise string constants by putting them in the symbol table.

This commit is contained in:
Eelco Dolstra 2010-10-23 21:11:59 +00:00
parent 8ac06726b9
commit b2ba62170c
4 changed files with 55 additions and 39 deletions

View file

@ -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);
}