Improve efficiency of using g_array_index
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / bt-service-audio.c
index 8118f4e..ff76b58 100644 (file)
@@ -603,7 +603,7 @@ static gboolean __bt_device_support_uuid(char *remote_address,
        int size;
        int i;
        int j;
-       bluetooth_device_info_t info;
+       bluetooth_device_info_t *info;
        char bond_address[BT_ADDRESS_STRING_SIZE] = { 0 };
        gboolean ret = FALSE;
 
@@ -615,23 +615,23 @@ static gboolean __bt_device_support_uuid(char *remote_address,
        size = (dev_list->len) / sizeof(bluetooth_device_info_t);
 
        for (i = 0; i < size; i++) {
-               info = g_array_index(dev_list, bluetooth_device_info_t, i);
+               info = &g_array_index(dev_list, bluetooth_device_info_t, i);
                _bt_convert_addr_type_to_string(bond_address,
-                               info.device_address.addr);
+                               info->device_address.addr);
                if (strcmp(bond_address, remote_address) != 0)
                        continue;
 
                BT_INFO("Device address Matched");
                j = 0;
-               while (j != info.service_index) {
+               while (j != info->service_index) {
                        if (type == BT_AUDIO_HSP) {
-                               if (strcmp(info.uuids[j], HFP_HS_UUID) == 0) {
+                               if (strcmp(info->uuids[j], HFP_HS_UUID) == 0) {
                                        BT_INFO("HFP HS UUID exists");
                                        ret = TRUE;
                                        goto end;
                                }
                        } else if (type == BT_AUDIO_A2DP) {
-                               if (strcmp(info.uuids[j], A2DP_SINK_UUID) == 0) {
+                               if (strcmp(info->uuids[j], A2DP_SINK_UUID) == 0) {
                                        BT_INFO("A2DP SINK UUID exists");
                                        ret = TRUE;
                                        goto end;