about summary refs log tree commit diff
path: root/third_party/nix/src/libexpr/attr-set.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-22T15·48+0100
committerVincent Ambo <tazjin@google.com>2020-05-22T15·57+0100
commitb3c9166b23aebbbfcbe65ea59e7ea18d876d45db (patch)
tree48b9e56e7bf8608e320fdc1420597f4c026bbb10 /third_party/nix/src/libexpr/attr-set.cc
parente24466c7951a96b35bea947e6e6854f277eda9d7 (diff)
refactor(3p/nix/libexpr): state->allocBindings -> Bindings::NewGC r/805
EvalState::allocBindings had little to do with Bindings, other than
returning them, and didn't belong in that class.
Diffstat (limited to 'third_party/nix/src/libexpr/attr-set.cc')
-rw-r--r--third_party/nix/src/libexpr/attr-set.cc7
1 files changed, 2 insertions, 5 deletions
diff --git a/third_party/nix/src/libexpr/attr-set.cc b/third_party/nix/src/libexpr/attr-set.cc
index 71777c95dc7b..e961156487a9 100644
--- a/third_party/nix/src/libexpr/attr-set.cc
+++ b/third_party/nix/src/libexpr/attr-set.cc
@@ -49,10 +49,7 @@ void Bindings::merge(Bindings* other) {
   attributes_.swap(other->attributes_);
 }
 
-// Allocate a new attribute set, making it visible to the garbage collector.
-Bindings* EvalState::allocBindings(size_t _capacity) {
-  return new (GC) Bindings;
-}
+Bindings* Bindings::NewGC() { return new (GC) Bindings; }
 
 void EvalState::mkAttrs(Value& v, size_t capacity) {
   if (capacity == 0) {
@@ -61,7 +58,7 @@ void EvalState::mkAttrs(Value& v, size_t capacity) {
   }
   clearValue(v);
   v.type = tAttrs;
-  v.attrs = new (GC) Bindings;
+  v.attrs = Bindings::NewGC();
   nrAttrsets++;
   nrAttrsInAttrsets += capacity;
 }