Avoid a call to find by using the return value of insert.

This commit is contained in:
Rafael Ávila de Espíndola 2015-04-06 15:45:37 -04:00
parent 9dbb4b021d
commit 5368dcf2ba
2 changed files with 7 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2015-04-06 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
* gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
to find by using the return value of insert.
2015-04-06 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
* gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy

View File

@ -40,15 +40,8 @@ Garbage_collection::do_transitive_closure()
// one by one.
Section_id entry = this->worklist().front();
this->worklist().pop();
if (this->referenced_list().find(entry)
== this->referenced_list().end())
{
this->referenced_list().insert(entry);
}
else
{
if (!this->referenced_list().insert(entry).second)
continue;
}
Garbage_collection::Section_ref::iterator find_it =
this->section_reloc_map().find(entry);
if (find_it == this->section_reloc_map().end())