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: Cary Coutant <ccoutant at google dot com>
- To: Rafael EspÃndola <rafael dot espindola at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Mon, 16 Feb 2015 19:36:50 -0800
- 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> <CAG3jReLNorxbByXEy-t-46jjQWiTL-XAPBu5xXQW12PN10WisQ at mail dot gmail dot com>
>> 2014-09-18 Rafael Ãvila de EspÃndola <rafael.espindola@gmail.com>
>> * gc.h (Garbage_collection::add_reference): Don't use find.
This could have been simplified to just this:
- 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);
+ this->section_reloc_map_[src_id].insert(dst_id);
I can see the readability benefit of the intermediate, so I'm OK with either.
Thanks!
-cary