mirror of
https://github.com/NixOS/nix
synced 2025-06-28 05:21:16 +02:00
Store Attrs inside Bindings
This prevents a double allocation per attribute set.
This commit is contained in:
parent
0342eb1705
commit
5b58991a71
9 changed files with 101 additions and 60 deletions
|
@ -161,12 +161,12 @@ void DrvInfo::setMeta(const string & name, Value * v)
|
|||
{
|
||||
getMeta();
|
||||
Bindings * old = meta;
|
||||
meta = new Bindings();
|
||||
meta = state->allocBindings(1 + (old ? old->size() : 0));
|
||||
Symbol sym = state->symbols.create(name);
|
||||
if (old)
|
||||
foreach (Bindings::iterator, i, *old)
|
||||
if (i->name != sym)
|
||||
meta->push_back(*i);
|
||||
for (auto i : *old)
|
||||
if (i.name != sym)
|
||||
meta->push_back(i);
|
||||
if (v) meta->push_back(Attr(sym, v));
|
||||
meta->sort();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue