OSDN Git Service

Const-ify size tBTM_CB::tBTM_BLE_CB::link_count[]
authorChris Manton <cmanton@google.com>
Fri, 18 Sep 2020 01:35:15 +0000 (18:35 -0700)
committerChris Manton <cmanton@google.com>
Mon, 21 Sep 2020 20:10:49 +0000 (20:10 +0000)
Towards readable code

Bug: 163134718
Tag: #refactor
Test: acts -tc BleCocTest
Test: ble paired 2 phones

Change-Id: I7d4e5e40600fc264fc30f51bb5a7fd1ebca7636d

stack/btm/btm_ble_int_types.h

index da0a8de..6bb615b 100644 (file)
@@ -224,6 +224,7 @@ typedef uint8_t tBTM_PRIVACY_MODE;
 */
 constexpr uint8_t kBTM_BLE_INQUIRY_ACTIVE = 0x10;
 constexpr uint8_t kBTM_BLE_OBSERVE_ACTIVE = 0x80;
+constexpr size_t kMasterAndSlaveCount = 2;
 
 typedef struct {
  private:
@@ -299,7 +300,9 @@ typedef struct {
 
   /* current BLE link state */
   tBTM_BLE_STATE_MASK cur_states; /* bit mask of tBTM_BLE_STATE */
-  uint8_t link_count[2];          /* total link count master and slave*/
+
+  uint8_t
+      link_count[kMasterAndSlaveCount]; /* total link count master and slave*/
 } tBTM_BLE_CB;
 
 #endif  // BTM_BLE_INT_TYPES_H