refactor(3p/nix): Remove unused insert_or_assign
This function in never called, so let's just remove it Paired-With: Luke Granger-Brown <git@lukegb.com> Paired-With: Vincent Ambo <mail@tazj.in> Change-Id: I79125866254d90dd0842bc86830d2103ac313cb6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1125 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: isomer <isomer@tvl.fyi>
This commit is contained in:
parent
d5597b4784
commit
785ca36316
2 changed files with 0 additions and 26 deletions
23
third_party/nix/src/libexpr/attr-set.cc
vendored
23
third_party/nix/src/libexpr/attr-set.cc
vendored
|
@ -66,7 +66,6 @@ class BTreeBindings : public Bindings {
|
||||||
size_t size() override;
|
size_t size() override;
|
||||||
bool empty() override;
|
bool empty() override;
|
||||||
void push_back(const Attr& attr) override;
|
void push_back(const Attr& attr) override;
|
||||||
void insert_or_assign(Attr& attr) override;
|
|
||||||
Bindings::iterator find(const Symbol& name) override;
|
Bindings::iterator find(const Symbol& name) override;
|
||||||
Bindings::iterator begin() override;
|
Bindings::iterator begin() override;
|
||||||
Bindings::iterator end() override;
|
Bindings::iterator end() override;
|
||||||
|
@ -96,11 +95,6 @@ void BTreeBindings::push_back(const Attr& attr) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert or assign (i.e. replace) a value in the attribute set.
|
|
||||||
void BTreeBindings::insert_or_assign(Attr& attr) {
|
|
||||||
attributes_.insert_or_assign(attr.name, attr);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t BTreeBindings::size() { return attributes_.size(); }
|
size_t BTreeBindings::size() { return attributes_.size(); }
|
||||||
|
|
||||||
bool BTreeBindings::empty() { return attributes_.empty(); }
|
bool BTreeBindings::empty() { return attributes_.empty(); }
|
||||||
|
@ -144,7 +138,6 @@ class VectorBindings : public Bindings {
|
||||||
size_t size() override;
|
size_t size() override;
|
||||||
bool empty() override;
|
bool empty() override;
|
||||||
void push_back(const Attr& attr) override;
|
void push_back(const Attr& attr) override;
|
||||||
void insert_or_assign(Attr& attr) override;
|
|
||||||
Bindings::iterator find(const Symbol& name) override;
|
Bindings::iterator find(const Symbol& name) override;
|
||||||
Bindings::iterator begin() override;
|
Bindings::iterator begin() override;
|
||||||
Bindings::iterator end() override;
|
Bindings::iterator end() override;
|
||||||
|
@ -159,22 +152,6 @@ size_t VectorBindings::size() { return attributes_.size(); }
|
||||||
|
|
||||||
bool VectorBindings::empty() { return attributes_.empty(); }
|
bool VectorBindings::empty() { return attributes_.empty(); }
|
||||||
|
|
||||||
// Insert or assign (i.e. replace) a value in the attribute set.
|
|
||||||
void VectorBindings::insert_or_assign(Attr& attr) {
|
|
||||||
for (auto it = attributes_.begin(); it != attributes_.end(); ++it) {
|
|
||||||
if (it->first == attr.name) {
|
|
||||||
it->second = attr;
|
|
||||||
return;
|
|
||||||
} else if (attr.name < it->first) {
|
|
||||||
// TODO convert to BTreeMap if we get big enough
|
|
||||||
attributes_.emplace(it, attr.name, attr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
attributes_.emplace_back(attr.name, attr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VectorBindings::merge(Bindings& other) {
|
void VectorBindings::merge(Bindings& other) {
|
||||||
AttributeVector new_attributes;
|
AttributeVector new_attributes;
|
||||||
new_attributes.reserve(size() + other.size());
|
new_attributes.reserve(size() + other.size());
|
||||||
|
|
3
third_party/nix/src/libexpr/attr-set.hh
vendored
3
third_party/nix/src/libexpr/attr-set.hh
vendored
|
@ -80,9 +80,6 @@ class Bindings {
|
||||||
// Insert, but do not replace, values in the attribute set.
|
// Insert, but do not replace, values in the attribute set.
|
||||||
virtual void push_back(const Attr& attr) = 0;
|
virtual void push_back(const Attr& attr) = 0;
|
||||||
|
|
||||||
// Insert a value, or replace an existing one.
|
|
||||||
virtual void insert_or_assign(Attr& attr) = 0;
|
|
||||||
|
|
||||||
// Look up a specific element of the attribute set.
|
// Look up a specific element of the attribute set.
|
||||||
virtual iterator find(const Symbol& name) = 0;
|
virtual iterator find(const Symbol& name) = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue