mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-22 14:19:57 +08:00
perf(uORB): match nodes by ORB_ID instead of strcmp
Assisted-by: Claude:claude-fable-5-1
This commit is contained in:
1 parent
537b82d380
commit
5abef6d065
1 file changed
+3
-1
@@ -454,8 +454,10 @@ uORB::DeviceNode *uORB::DeviceMaster::getDeviceNode(const char *nodepath)
|
||||
|
||||
uORB::DeviceNode *uORB::DeviceMaster::getDeviceNodeLocked(const struct orb_metadata *meta, const uint8_t instance)
|
||||
{
|
||||
const ORB_ID id = static_cast<ORB_ID>(meta->o_id);
|
||||
|
||||
for (uORB::DeviceNode *node : _node_list) {
|
||||
if ((strcmp(node->get_name(), meta->o_name) == 0) && (node->get_instance() == instance)) {
|
||||
if ((node->id() == id) && (node->get_instance() == instance)) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user