diff options
Diffstat (limited to 'third_party/nix/src/libexpr/attr-set.cc')
-rw-r--r-- | third_party/nix/src/libexpr/attr-set.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/third_party/nix/src/libexpr/attr-set.cc b/third_party/nix/src/libexpr/attr-set.cc index 495f9816c7aa..6310cc66b726 100644 --- a/third_party/nix/src/libexpr/attr-set.cc +++ b/third_party/nix/src/libexpr/attr-set.cc @@ -59,13 +59,10 @@ Bindings::iterator Bindings::begin() { return attributes_.begin(); } Bindings::iterator Bindings::end() { return attributes_.end(); } -void Bindings::merge(Bindings* other) { - // We want the values from the other attribute set to take - // precedence, but .merge() works the other way around. - // - // To work around that, we merge and then swap. - other->attributes_.merge(attributes_); - attributes_.swap(other->attributes_); +void Bindings::merge(const Bindings& other) { + for (auto& [key, value] : other.attributes_) { + this->attributes_[key] = value; + } } Bindings* Bindings::NewGC() { return new (GC) Bindings; } |