From f52496654cc5f2af171051daf740c12bef3cf4e7 Mon Sep 17 00:00:00 2001 From: Chris Manton Date: Sun, 16 Aug 2020 15:03:26 -0700 Subject: [PATCH] Simplify StackAclBtmAcl::btm_bda_to_acl Towards proper interfaces Bug: 163134718 Tag: #refactor Test: act.py -tc BleCocTest Test: ble paired 2 phones Test: classic paired Bose SoundLink Change-Id: I6573f60cbf5e469fe780c6d5a4506c0dcd39f590 --- stack/acl/btm_acl.cc | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/stack/acl/btm_acl.cc b/stack/acl/btm_acl.cc index ebccfa1bc..c7fd126b8 100644 --- a/stack/acl/btm_acl.cc +++ b/stack/acl/btm_acl.cc @@ -203,22 +203,20 @@ void BTM_acl_after_controller_started() { * (BR/EDR or LE) * * Returns Returns pointer to the ACL DB for the requested BDA if found. - * NULL if not found. + * nullptr if not found. * ******************************************************************************/ tACL_CONN* StackAclBtmAcl::btm_bda_to_acl(const RawAddress& bda, tBT_TRANSPORT transport) { - tACL_CONN* p = &btm_cb.acl_cb_.acl_db[0]; - uint16_t xx; - for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p++) { - if ((p->in_use) && p->remote_addr == bda && p->transport == transport) { + tACL_CONN* p_acl = &btm_cb.acl_cb_.acl_db[0]; + for (uint8_t index = 0; index < MAX_L2CAP_LINKS; index++, p_acl++) { + if ((p_acl->in_use) && p_acl->remote_addr == bda && + p_acl->transport == transport) { BTM_TRACE_DEBUG("btm_bda_to_acl found"); - return (p); + return p_acl; } } - - /* If here, no BD Addr found */ - return ((tACL_CONN*)NULL); + return nullptr; } /******************************************************************************* -- 2.11.0