diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-09-19T14·49+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-09-19T14·49+0200 |
commit | 5b58991a71d15123c010bbbd7f08530dbc31173f (patch) | |
tree | 3cec3413ee43ddd8b46b950022e0741a7c166fd7 /src/libexpr/get-drvs.cc | |
parent | 0342eb170500f726f11269d26a1f34cded5d3676 (diff) |
Store Attrs inside Bindings
This prevents a double allocation per attribute set.
Diffstat (limited to 'src/libexpr/get-drvs.cc')
-rw-r--r-- | src/libexpr/get-drvs.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc index db91eab37156..1c9fa02a366a 100644 --- a/src/libexpr/get-drvs.cc +++ b/src/libexpr/get-drvs.cc @@ -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(); } |