Avoid a call to find by using the return value of insert.
authorRafael Ávila de Espíndola <rafael.espindola@gmail.com>
Mon, 6 Apr 2015 19:45:37 +0000 (15:45 -0400)
committerRafael Ávila de Espíndola <rafael.espindola@gmail.com>
Mon, 6 Apr 2015 19:46:30 +0000 (15:46 -0400)
gold/ChangeLog
gold/gc.cc

index 9eadf3b7cc92b9bccca511f1e000cd3db3c4b088..25d45889f735ab19bbc8bb648b80811782e4b025 100644 (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
index 95867c4bbb6ef4c912b9c5af7698e90a8660b8b0..16bdb19931d80bf7604eeb95dc8f58d3b4bad5bf 100644 (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
-        {
-          continue;
-        }
+      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())