[patch] Simplify Garbage_collection::add_reference a bit

Cary Coutant ccoutant@google.com
Tue Feb 17 03:36:00 GMT 2015


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



More information about the Binutils mailing list