This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Simplify Garbage_collection::add_reference a bit


>> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]