This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch] Simplify Garbage_collection::add_reference a bit
- From: Rafael EspÃndola <rafael dot espindola at gmail dot com>
- To: Binutils <binutils at sourceware dot org>
- Cc: Cary Coutant <ccoutant at google dot com>
- Date: Thu, 5 Feb 2015 11:03:56 -0500
- Subject: Re: [patch] Simplify Garbage_collection::add_reference a bit
- Authentication-results: sourceware.org; auth=none
- References: <CAG3jRe+_aKC2m8M-ZGu2bg990zicFGX965xA8bdfRmuKdhyonA at mail dot gmail dot com>
I noticed I had the '&' close to the variable instead of the type.
Fixed in the attached patch.
On 2 February 2015 at 17:58, Rafael EspÃndola
<rafael.espindola@gmail.com> wrote:
> this->section_reloc_map_[src_id] is created if it doesn't exist, so there
> is no point in doing a find.
>
> Cheers,
> Rafael
>
> 2014-09-18 Rafael Ãvila de EspÃndola <rafael.espindola@gmail.com>
> * gc.h (Garbage_collection::add_reference): Don't use find.
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: