uORB::DeviceMaster::ioctl: avoid operator[], since we already have the iterator

In the existing implementation, the map had to be searched twice.
This commit is contained in:
Beat Küng 2016-04-15 12:53:16 +02:00 committed by tumbili
parent 9c360e9f88
commit e9019582cc
1 changed files with 3 additions and 2 deletions

View File

@ -688,8 +688,9 @@ uORB::DeviceNode *uORB::DeviceMaster::GetDeviceNode(const char *nodepath)
uORB::DeviceNode *rc = nullptr;
std::string np(nodepath);
if (_node_map.find(np) != _node_map.end()) {
rc = _node_map[np];
auto iter = _node_map.find(np);
if (iter != _node_map.end()) {
rc = iter->second;
}
return rc;