refactor(3p/nix/libexpr): Make other 'const' in Bindings::merge
This commit is contained in:
parent
ab1fbd4c6e
commit
55b1a47647
2 changed files with 5 additions and 8 deletions
11
third_party/nix/src/libexpr/attr-set.cc
vendored
11
third_party/nix/src/libexpr/attr-set.cc
vendored
|
@ -59,13 +59,10 @@ Bindings::iterator Bindings::begin() { return attributes_.begin(); }
|
||||||
|
|
||||||
Bindings::iterator Bindings::end() { return attributes_.end(); }
|
Bindings::iterator Bindings::end() { return attributes_.end(); }
|
||||||
|
|
||||||
void Bindings::merge(Bindings* other) {
|
void Bindings::merge(const Bindings& other) {
|
||||||
// We want the values from the other attribute set to take
|
for (auto& [key, value] : other.attributes_) {
|
||||||
// precedence, but .merge() works the other way around.
|
this->attributes_[key] = value;
|
||||||
//
|
}
|
||||||
// To work around that, we merge and then swap.
|
|
||||||
other->attributes_.merge(attributes_);
|
|
||||||
attributes_.swap(other->attributes_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Bindings* Bindings::NewGC() { return new (GC) Bindings; }
|
Bindings* Bindings::NewGC() { return new (GC) Bindings; }
|
||||||
|
|
2
third_party/nix/src/libexpr/attr-set.hh
vendored
2
third_party/nix/src/libexpr/attr-set.hh
vendored
|
@ -64,7 +64,7 @@ class Bindings {
|
||||||
iterator end();
|
iterator end();
|
||||||
|
|
||||||
// Merge values from other into the current attribute
|
// Merge values from other into the current attribute
|
||||||
void merge(Bindings* other);
|
void merge(const Bindings& other);
|
||||||
|
|
||||||
// ???
|
// ???
|
||||||
[[deprecated]] size_t capacity();
|
[[deprecated]] size_t capacity();
|
||||||
|
|
Loading…
Reference in a new issue