diff options
author | merge-script <falke.marco@gmail.com> | 2021-09-17 14:25:10 +0200 |
---|---|---|
committer | merge-script <falke.marco@gmail.com> | 2021-09-17 14:25:10 +0200 |
commit | e69cbac628bfdca4a8e4ead821190eaf5b6b3d07 (patch) | |
tree | 3eb2cbc0b48acf336a777f51ca79a86df3e573c4 /src/init.cpp | |
parent | 6401de0133e32a641ed9e78a85b3aa337c75d190 (diff) | |
parent | 330d3aa1a2c740dfa31bed3a6ed6b5f88e5426ad (diff) | |
download | bitcoin-e69cbac628bfdca4a8e4ead821190eaf5b6b3d07.tar.xz |
Merge bitcoin/bitcoin#22896: refactor: net: avoid duplicate map lookups to `mapLocalHost`
330d3aa1a2c740dfa31bed3a6ed6b5f88e5426ad refactor: net: avoid duplicate map lookups to `mapLocalHost` (Sebastian Falbesoner)
Pull request description:
This simple refactoring PR aims to avoid duplicate lookups to `mapLocalHost`: instead of calling `count()` (to first find out whether a key is in the map) and then `operator[]` (to get the value to the passed key, or default-construct one if not found), use either
* `find()` and dereference the returned iterator (for simple lookups), see https://www.cplusplus.com/reference/map/map/find/
* `emplace()` and use the returned <iterator, inserted> pair (for lookups where a new element should be inserted if the key isn't found), see https://www.cplusplus.com/reference/map/map/emplace/
ACKs for top commit:
naumenkogs:
ACK 330d3aa1a2c740dfa31bed3a6ed6b5f88e5426ad
jonatack:
Code review ACK 330d3aa1a2c740dfa31bed3a6ed6b5f88e5426ad plus rebase to master + debug build
Tree-SHA512: d13da6a927ff561eee8ac6b093bf3586dfe31d6c94173a5a6d8f3698e0ee224fb394d3635155d5141c165da59d2c2c37260122eb4f2e8bcda3e8a29b901d213e
Diffstat (limited to 'src/init.cpp')
0 files changed, 0 insertions, 0 deletions