OSDN Git Service

Combine decl/defs bta/hh/bta_hh_le::bta_hh_gatt_close
authorChris Manton <cmanton@google.com>
Fri, 7 May 2021 01:37:28 +0000 (18:37 -0700)
committerChris Manton <cmanton@google.com>
Sun, 9 May 2021 04:52:41 +0000 (04:52 +0000)
Towards readable code

Bug: 163134718
Test: gd/cert/run
Tag: #refactor
Change-Id: I4bb2f4480d97ff59a000c94489837315b852c0e5

bta/hh/bta_hh_le.cc

index ad71da8..40f9cbb 100644 (file)
@@ -1607,7 +1607,6 @@ void bta_hh_le_open_fail(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) {
  *
  ******************************************************************************/
 void bta_hh_gatt_close(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) {
-  tBTA_HH_CBDATA disc_dat = {BTA_HH_OK, 0};
 
   /* deregister all notification */
   bta_hh_le_deregister_input_notif(p_cb);
@@ -1616,9 +1615,10 @@ void bta_hh_gatt_close(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) {
   /* update total conn number */
   bta_hh_cb.cnt_num--;
 
-  disc_dat.handle = p_cb->hid_handle;
-  disc_dat.status = p_cb->status;
-
+  tBTA_HH_CBDATA disc_dat = {
+      .status = p_cb->status,
+      .handle = p_cb->hid_handle,
+  };
   (*bta_hh_cb.p_cback)(BTA_HH_CLOSE_EVT, (tBTA_HH*)&disc_dat);
 
   /* if no connection is active and HH disable is signaled, disable service */