From: Deokhyun Kim Date: Tue, 26 May 2020 09:23:47 +0000 (+0900) Subject: Simplify the logic to manage invocation list X-Git-Tag: accepted/tizen/unified/20200610.015607~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F48%2F235348%2F1;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git Simplify the logic to manage invocation list Change-Id: Ic7df672381bd027f977e4e0f0306d59381f58654 Signed-off-by: Deokhyun Kim Signed-off-by: Wootak Jung --- diff --git a/bt-service-adaptation/services/adapter/bt-service-core-adapter-le.c b/bt-service-adaptation/services/adapter/bt-service-core-adapter-le.c index 5608b12..5cc0561 100644 --- a/bt-service-adaptation/services/adapter/bt-service-core-adapter-le.c +++ b/bt-service-adaptation/services/adapter/bt-service-core-adapter-le.c @@ -307,7 +307,6 @@ static void __bt_adapter_le_handle_pending_request_info(int result, _bt_service_method_return(req_info->context, out_param, result); /* Free data */ - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); } diff --git a/bt-service-adaptation/services/audio/a2dp_sink/bt-service-a2dp-sink.c b/bt-service-adaptation/services/audio/a2dp_sink/bt-service-a2dp-sink.c index 31fe10f..dc7638a 100644 --- a/bt-service-adaptation/services/audio/a2dp_sink/bt-service-a2dp-sink.c +++ b/bt-service-adaptation/services/audio/a2dp_sink/bt-service-a2dp-sink.c @@ -220,7 +220,6 @@ dbus_return: _bt_service_method_return(req_info->context, out_param, result); g_array_free(out_param, TRUE); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); } } @@ -265,7 +264,6 @@ static void __bt_reply_av_source_connection_pending_request(bluetooth_device_add _bt_service_method_return(req_info->context, out_param, result); g_array_free(out_param, TRUE); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); } @@ -301,7 +299,6 @@ static void __bt_reply_av_source_disconnection_pending_request(bluetooth_device_ _bt_service_method_return(req_info->context, out_param, result); g_array_free(out_param, TRUE); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); } diff --git a/bt-service-adaptation/services/audio/a2dp_src/bt-service-a2dp-src.c b/bt-service-adaptation/services/audio/a2dp_src/bt-service-a2dp-src.c index 5cc255d..9e821b0 100644 --- a/bt-service-adaptation/services/audio/a2dp_src/bt-service-a2dp-src.c +++ b/bt-service-adaptation/services/audio/a2dp_src/bt-service-a2dp-src.c @@ -161,7 +161,6 @@ static void __bt_handle_av_connected_state(bluetooth_device_address_t *address) _bt_service_method_return(req_info->context, out_param, result); g_array_free(out_param, TRUE); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); } @@ -285,7 +284,6 @@ dbus_return: _bt_service_method_return(req_info->context, out_param, result); g_array_free(out_param, TRUE); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); } } diff --git a/bt-service-adaptation/services/audio/avrcp/bt-service-avrcp-ctrl.c b/bt-service-adaptation/services/audio/avrcp/bt-service-avrcp-ctrl.c index 8bd7886..80a52cd 100644 --- a/bt-service-adaptation/services/audio/avrcp/bt-service-avrcp-ctrl.c +++ b/bt-service-adaptation/services/audio/avrcp/bt-service-avrcp-ctrl.c @@ -399,7 +399,6 @@ static void __bt_reply_avrcp_ct_connection_pending_request(bluetooth_device_addr _bt_service_method_return(req_info->context, out_param, result); g_array_free(out_param, TRUE); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); } @@ -450,7 +449,6 @@ static void __bt_reply_avrcp_ct_disconnection_pending_request(bluetooth_device_a _bt_service_method_return(req_info->context, out_param, result); g_array_free(out_param, TRUE); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); } @@ -693,7 +691,6 @@ static void __bt_handle_avrcp_get_property_res_event(avrcp_ct_player_property_ty BT_INFO("Request found"); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); } diff --git a/bt-service-adaptation/services/audio/avrcp/bt-service-avrcp-tg.c b/bt-service-adaptation/services/audio/avrcp/bt-service-avrcp-tg.c index 351e674..2ea7f0c 100644 --- a/bt-service-adaptation/services/audio/avrcp/bt-service-avrcp-tg.c +++ b/bt-service-adaptation/services/audio/avrcp/bt-service-avrcp-tg.c @@ -574,7 +574,6 @@ static void __handle_avrcp_connection_event(int event, bt_address_t *bdaddr) _bt_service_method_return(req_info->context, out_param, result); g_array_free(out_param, TRUE); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); } diff --git a/bt-service-adaptation/services/audio/bt-service-audio.c b/bt-service-adaptation/services/audio/bt-service-audio.c index ffed1d4..9c997af 100644 --- a/bt-service-adaptation/services/audio/bt-service-audio.c +++ b/bt-service-adaptation/services/audio/bt-service-audio.c @@ -416,7 +416,6 @@ static void __bt_remove_device_from_wait_list(char *prev_waiting_device) _bt_service_method_return(req_info->context, out_param, result); g_array_free(out_param, TRUE); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); } } @@ -718,7 +717,6 @@ static void __bt_reply_pending_audio_connect_req(char *address, int result) _bt_service_method_return(req_info->context, out_param, result); g_array_free(out_param, TRUE); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); BT_DBG("-"); diff --git a/bt-service-adaptation/services/audio/hf/bt-service-hf-client.c b/bt-service-adaptation/services/audio/hf/bt-service-hf-client.c index 646669f..33f85f3 100644 --- a/bt-service-adaptation/services/audio/hf/bt-service-hf-client.c +++ b/bt-service-adaptation/services/audio/hf/bt-service-hf-client.c @@ -74,7 +74,6 @@ static void __bt_reply_hf_client_disconnection_pending_request(bt_address_t *add g_array_append_vals(out_param, &device_address, sizeof(bluetooth_device_address_t)); _bt_service_method_return(req_info->context, out_param, result); g_array_free(out_param, TRUE); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); BT_DBG("-"); @@ -111,7 +110,6 @@ static void __bt_reply_hf_client_connection_pending_request(bt_address_t *addres g_array_append_vals(out_param, &device_address, sizeof(bluetooth_device_address_t)); _bt_service_method_return(req_info->context, out_param, result); g_array_free(out_param, TRUE); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); BT_DBG("-"); diff --git a/bt-service-adaptation/services/audio/hf/bt-service-hf.c b/bt-service-adaptation/services/audio/hf/bt-service-hf.c index 3917a92..a33f039 100755 --- a/bt-service-adaptation/services/audio/hf/bt-service-hf.c +++ b/bt-service-adaptation/services/audio/hf/bt-service-hf.c @@ -139,7 +139,6 @@ static void __bt_reply_hf_disconnection_pending_request(bt_address_t *address) _bt_service_method_return(req_info->context, out_param, result); g_array_free(out_param, TRUE); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); try_waiting_device: @@ -219,7 +218,6 @@ dbus_return: _bt_service_method_return(req_info->context, out_param, BLUETOOTH_ERROR_NONE); g_array_free(out_param, TRUE); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); } diff --git a/bt-service-adaptation/services/bt-request-handler.c b/bt-service-adaptation/services/bt-request-handler.c index a879275..d318f99 100644 --- a/bt-service-adaptation/services/bt-request-handler.c +++ b/bt-service-adaptation/services/bt-request-handler.c @@ -161,28 +161,11 @@ GSList *_bt_get_invocation_list(void) void _bt_free_info_from_invocation_list(invocation_info_t *req_info) { - GSList *l; - invocation_info_t *info; - ret_if(NULL == req_info); - ret_if(NULL == req_info->sender); - - for (l = invocation_list; l != NULL; l = g_slist_next(l)) { - info = l->data; - if (NULL == info || NULL == info->sender) - continue; - - /* No two same sync requests from same application can exist */ - if ((strcasecmp(info->sender, req_info->sender) == 0) && - req_info->service_function == info->service_function) { - - invocation_list = g_slist_remove(invocation_list, req_info); - g_free(req_info->sender); - g_free(req_info); - break; - } - } - + invocation_list = g_slist_remove(invocation_list, req_info); + g_free(req_info->sender); + g_free(req_info->user_data); + g_free(req_info); } void _bt_set_le_intended_status(gboolean value) diff --git a/bt-service-adaptation/services/device/bt-service-core-device.c b/bt-service-adaptation/services/device/bt-service-core-device.c index 9585a7b..cabb572 100644 --- a/bt-service-adaptation/services/device/bt-service-core-device.c +++ b/bt-service-adaptation/services/device/bt-service-core-device.c @@ -262,7 +262,6 @@ void __bt_device_handle_pending_requests(int result, int service_function, g_array_append_vals(out_param, &sdp_info, sizeof(bt_sdp_info_t)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); } @@ -284,7 +283,6 @@ void __bt_device_handle_pending_requests(int result, int service_function, sizeof(bluetooth_device_info_t)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); } @@ -304,7 +302,6 @@ void __bt_device_handle_pending_requests(int result, int service_function, sizeof(bluetooth_device_address_t)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); } diff --git a/bt-service-adaptation/services/gatt/bt-service-gatt.c b/bt-service-adaptation/services/gatt/bt-service-gatt.c index a3a0d78..7ab0679 100644 --- a/bt-service-adaptation/services/gatt/bt-service-gatt.c +++ b/bt-service-adaptation/services/gatt/bt-service-gatt.c @@ -918,7 +918,6 @@ static void __bt_gatt_handle_pending_request_info(int result, g_array_append_vals(out_param, ¶m->instance_id, sizeof(int)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); } @@ -937,7 +936,6 @@ static void __bt_gatt_handle_pending_request_info(int result, g_array_append_vals(out_param, &saved_instance_id, sizeof(int)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); } @@ -953,7 +951,6 @@ static void __bt_gatt_handle_pending_request_info(int result, g_array_append_vals(out_param, handle, sizeof(int)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); break; @@ -975,7 +972,6 @@ static void __bt_gatt_handle_pending_request_info(int result, sizeof(bluetooth_device_address_t)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); } @@ -986,7 +982,6 @@ static void __bt_gatt_handle_pending_request_info(int result, sizeof(bluetooth_device_address_t)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); @@ -1005,7 +1000,6 @@ static void __bt_gatt_handle_pending_request_info(int result, g_array_append_vals(out_param, ¶m->client_id, sizeof(int)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); } @@ -1029,7 +1023,6 @@ static void __bt_gatt_handle_pending_request_info(int result, //g_array_append_vals(out_param, ¶m->client_id, sizeof(int)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); } @@ -1055,7 +1048,6 @@ static void __bt_gatt_handle_pending_request_info(int result, g_array_append_vals(out_param, ¶m, sizeof(bt_char_browse_info_t)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); } @@ -1079,7 +1071,6 @@ static void __bt_gatt_handle_pending_request_info(int result, g_array_append_vals(out_param, param, sizeof(bt_descriptor_browse_info_t)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); } @@ -1102,7 +1093,6 @@ static void __bt_gatt_handle_pending_request_info(int result, out_param = g_array_new(FALSE, FALSE, sizeof(gchar)); g_array_append_vals(out_param, param, sizeof(bt_gatt_notif_reg_info_t)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); } @@ -1122,7 +1112,6 @@ static void __bt_gatt_handle_pending_request_info(int result, g_array_append_vals(out_param, param, sizeof(bluetooth_gatt_client_char_prop_info_t)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); } @@ -1143,7 +1132,6 @@ static void __bt_gatt_handle_pending_request_info(int result, g_array_append_vals(out_param, param, sizeof(bluetooth_gatt_client_desc_prop_info_t)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); } @@ -1164,7 +1152,6 @@ static void __bt_gatt_handle_pending_request_info(int result, sizeof(bluetooth_device_address_t)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); } diff --git a/bt-service-adaptation/services/health/bt-service-hdp.c b/bt-service-adaptation/services/health/bt-service-hdp.c index 76ed9e8..01f564c 100644 --- a/bt-service-adaptation/services/health/bt-service-hdp.c +++ b/bt-service-adaptation/services/health/bt-service-hdp.c @@ -95,7 +95,6 @@ static void __bt_hdp_handle_pending_request_info(int result, out_param = g_array_new(FALSE, FALSE, sizeof(gchar)); g_array_append_vals(out_param, app_handle, strlen(app_handle)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); g_free(app_handle); @@ -116,7 +115,6 @@ static void __bt_hdp_handle_pending_request_info(int result, g_array_append_vals(out_param, conn_data, sizeof(bt_hdp_connected_t)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); break; @@ -131,7 +129,6 @@ static void __bt_hdp_handle_pending_request_info(int result, out_param = g_array_new(FALSE, FALSE, sizeof(gchar)); g_array_append_vals(out_param, disconn_data, sizeof(bt_hdp_disconnected_t)); _bt_service_method_return(req_info->context, out_param, result); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); break; @@ -160,7 +157,6 @@ static void __bt_hdp_handle_pending_request_info(int result, req_info->context, out_param, result, fd_list); if (fd_list) g_object_unref(fd_list); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); return; diff --git a/bt-service-adaptation/services/hid/bt-service-hidhost.c b/bt-service-adaptation/services/hid/bt-service-hidhost.c index e0197f6..acea5b7 100644 --- a/bt-service-adaptation/services/hid/bt-service-hidhost.c +++ b/bt-service-adaptation/services/hid/bt-service-hidhost.c @@ -223,7 +223,6 @@ static void __bt_hid_event_handler(int event_type, gpointer event_data) _bt_service_method_return(req_info->context, out_param, result); g_array_free(out_param, TRUE); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); } __bt_handle_hid_connection(address); @@ -269,7 +268,6 @@ static void __bt_hid_event_handler(int event_type, gpointer event_data) _bt_service_method_return(req_info->context, out_param, result); g_array_free(out_param, TRUE); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); } break; diff --git a/bt-service-adaptation/services/rfcomm/bt-service-rfcomm.c b/bt-service-adaptation/services/rfcomm/bt-service-rfcomm.c index a7558ab..1bbb9d6 100644 --- a/bt-service-adaptation/services/rfcomm/bt-service-rfcomm.c +++ b/bt-service-adaptation/services/rfcomm/bt-service-rfcomm.c @@ -91,7 +91,6 @@ static void __bt_rfcomm_reply_pending_request(int result, if (fd_list) g_object_unref(fd_list); - g_free(req_info->user_data); _bt_free_info_from_invocation_list(req_info); g_array_free(out_param, TRUE); break;