[binutils-gdb] Simplify Garbage_collection::add_reference a bit.

Rafael थvila de Espथऐndola espindola@sourceware.org
Tue Feb 17 15:50:00 GMT 2015


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3a935c6cf98c47eaac4395622bfaf2ff517abd34

commit 3a935c6cf98c47eaac4395622bfaf2ff517abd34
Author: Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
Date:   Tue Feb 17 10:49:41 2015 -0500

    Simplify Garbage_collection::add_reference a bit.
    
    this->section_reloc_map_[src_id] is created if it doesn't exist, so there
    is no point in doing a find.

Diff:
---
 gold/ChangeLog | 4 ++++
 gold/gc.h      | 7 ++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/gold/ChangeLog b/gold/ChangeLog
index 5a72e98..5669635 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,5 +1,9 @@
 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
 
+	* gc.h (Garbage_collection::add_reference): Don't use find.
+
+2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
+
 	* object.cc (write_local_symbols): avoid std::vector copy.
 
 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
diff --git a/gold/gc.h b/gold/gc.h
index 2db7cb9..be4a63c 100644
--- a/gold/gc.h
+++ b/gold/gc.h
@@ -109,11 +109,8 @@ class Garbage_collection
   {
     Section_id src_id(src_object, src_shndx);
     Section_id dst_id(dst_object, dst_shndx);
-    Section_ref::iterator p = this->section_reloc_map_.find(src_id);
-    if (p == this->section_reloc_map_.end())
-      this->section_reloc_map_[src_id].insert(dst_id);
-    else
-      p->second.insert(dst_id);
+    Sections_reachable& reachable = this->section_reloc_map_[src_id];
+    reachable.insert(dst_id);
   }
 
  private:



More information about the Binutils-cvs mailing list