refactor(3p/nix/libexpr): Use absl::btree_map::merge for '//'
Instead of doing some sort of inline merge-sort of the two attribute sets, use the attribute sets merge function. This commit alone does not build and is not supposed to.
This commit is contained in:
parent
28e347effe
commit
ee4637e3a2
3 changed files with 14 additions and 22 deletions
8
third_party/nix/src/libexpr/attr-set.cc
vendored
8
third_party/nix/src/libexpr/attr-set.cc
vendored
|
|
@ -37,6 +37,14 @@ Bindings::iterator Bindings::find(const Symbol& name) {
|
|||
Bindings::iterator Bindings::begin() { return &(attributes_.begin()->second); }
|
||||
|
||||
Bindings::iterator Bindings::end() { return &(attributes_.end()->second); }
|
||||
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_);
|
||||
}
|
||||
|
||||
// /* Allocate a new array of attributes for an attribute set with a specific
|
||||
// capacity. The space is implicitly reserved after the Bindings structure.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue