#include <dbg.h>
#include <account-private.h>
+#include <account_free.h>
#include <account_ipc_marshal.h>
#include <account-mgr-stub.h>
static AccountManager *_acc_mgr = NULL;
-static char *_account_get_text(const char *text_data);
-static int _account_gslist_free(GSList* list);
-static int _account_glist_free(GList* list);
-
-static int _account_free_capability_items(account_capability_s *data)
-{
- if(!data) {
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- _ACCOUNT_FREE(data->type);
- _ACCOUNT_FREE(data->package_name);
- _ACCOUNT_FREE(data->user_name);
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_free_custom_items(account_custom_s *data)
-{
- if(!data) {
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- _ACCOUNT_FREE(data->app_id);
- _ACCOUNT_FREE(data->key);
- _ACCOUNT_FREE(data->value);
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_capability_gslist_free(GSList* list)
-{
- if(!list){
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- GSList* iter;
-
- for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
- account_capability_s *capability_data = (account_capability_s*)iter->data;
- _account_free_capability_items(capability_data);
- _ACCOUNT_FREE(capability_data);
- }
-
- g_slist_free(list);
- list = NULL;
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_custom_gslist_free(GSList* list)
-{
- if(!list){
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- GSList* iter;
-
- for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
- account_custom_s *custom_data = (account_custom_s*)iter->data;
- _account_free_custom_items(custom_data);
- _ACCOUNT_FREE(custom_data);
- }
-
- g_slist_free(list);
- list = NULL;
-
- return ACCOUNT_ERROR_NONE;
-}
-/*
-static int _account_list_free(GList* list)
-{
- if(!list){
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- g_list_free_full(list, g_free);
- list = NULL;
-
- return ACCOUNT_ERROR_NONE;
-}
-*/
-
-static int _account_free_account_items(account_s *data)
-{
- if(!data) {
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- _ACCOUNT_FREE(data->user_name);
- _ACCOUNT_FREE(data->email_address);
- _ACCOUNT_FREE(data->display_name);
- _ACCOUNT_FREE(data->icon_path);
- _ACCOUNT_FREE(data->source);
- _ACCOUNT_FREE(data->package_name);
- _ACCOUNT_FREE(data->domain_name);
- _ACCOUNT_FREE(data->access_token);
-
- int i;
- for(i=0;i<USER_TXT_CNT;i++)
- _ACCOUNT_FREE(data->user_data_txt[i]);
-
- _account_capability_gslist_free(data->capablity_list);
- _account_glist_free(data->account_list);
- _account_custom_gslist_free(data->custom_list);
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_gslist_free(GSList* list)
-{
- if(!list){
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- GSList* iter;
-
- for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
- account_s *account_record = (account_s*)iter->data;
- _account_free_account_items(account_record);
- _ACCOUNT_FREE(account_record);
- }
-
- g_slist_free(list);
- list = NULL;
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_glist_free(GList* list)
-{
- if(!list){
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- GList* iter;
-
- for (iter = list; iter != NULL; iter = g_list_next(iter)) {
- account_s *account_record = (account_s*)iter->data;
- _account_free_account_items(account_record);
- _ACCOUNT_FREE(account_record);
- }
-
- g_list_free(list);
- list = NULL;
-
- return ACCOUNT_ERROR_NONE;
-}
-
static char *_account_get_text(const char *text_data)
{
char *text_value = NULL;
if (g_strcmp0(_account_svc_errors[i].dbus_error_name, remote_error) == 0)
{
_INFO("Remote error code matched[%d]", _account_svc_errors[i].error_code);
+ g_free(remote_error);
return _account_svc_errors[i].error_code;
}
}
+ g_free(remote_error);
}
}
//All undocumented errors mapped to ACCOUNT_ERROR_PERMISSION_DENIED
error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
_ERR("account_manager_call_account_delete_from_db_by_user_name_sync failed [%d]", error_code);
- _account_gslist_free(account_list);
+ _account_gslist_account_free(account_list);
return error_code;
}
g_clear_error(&error);
- _account_gslist_free(account_list);
+ _account_gslist_account_free(account_list);
return ACCOUNT_ERROR_NONE;
}
ACCOUNT_RETURN_VAL((data != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Account handle is null!"));
- _account_free_account_items(data);
- _ACCOUNT_FREE(data);
+ _account_free_account_with_items(data);
_INFO("account_destroy end");
return ACCOUNT_ERROR_NONE;
}
_INFO("After one iteration callback");
}
- _account_gslist_free(account_list);
+ _account_gslist_account_free(account_list);
_INFO("account_foreach_account_from_db end");
return ACCOUNT_ERROR_NONE;
account_s **input = (account_s **)account;
- _account_free_account_items(*input);
- _ACCOUNT_FREE(*input);
+ _account_free_account_with_items(*input);
*input = account_data;
}
_INFO("account_query_account_by_user_name end");
- _account_gslist_free(account_list);
+ _account_gslist_account_free(account_list);
return ACCOUNT_ERROR_NONE;
}
break;
}
}
- _account_gslist_free(account_list);
+ _account_gslist_account_free(account_list);
_INFO("account_query_account_by_package_name end");
return ACCOUNT_ERROR_NONE;
}
break;
}
}
- _account_gslist_free(account_list);
+ _account_gslist_account_free(account_list);
_INFO("account_query_account_by_capability end");
return ACCOUNT_ERROR_NONE;
}
break;
}
}
- _account_gslist_free(account_list);
+ _account_gslist_account_free(account_list);
_INFO("account_query_account_by_capability end");
return ACCOUNT_ERROR_NONE;
}
_INFO("");
}
- _account_capability_gslist_free(capability_list);
+ _account_gslist_capability_free(capability_list);
_INFO("account_query_capability_by_account_id end");
return ACCOUNT_ERROR_NONE;
}
return error_code;
}
+/*
static int _account_type_free_label_items(label_s *data)
{
if(!data) {
return ACCOUNT_ERROR_NONE;
}
+*/
/*
static int _account_type_glist_free(GList* list)
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- _account_type_free_account_type_items(data);
- _ACCOUNT_FREE(data);
+ _account_type_free_account_type_with_items(data);
return ACCOUNT_ERROR_NONE;
}
}
}
- _account_type_provider_feature_gslist_free(provider_feature_list);
+ _account_type_gslist_feature_free(provider_feature_list);
_INFO("account_type_query_provider_feature_by_app_id end");
return error_code;
}
_INFO("");
}
- _account_type_label_gslist_free(label_list);
+ _account_type_gslist_label_free(label_list);
_INFO("account_type_query_label_by_app_id end");
return ACCOUNT_ERROR_NONE;
}
}
}
- _account_type_gslist_free(account_type_list);
+ _account_type_gslist_account_type_free(account_type_list);
_INFO("account_type_foreach_account_type_from_db end");
return ACCOUNT_ERROR_NONE;
}
_INFO("");
}
- _account_type_gslist_free(account_type_list);
+ _account_type_gslist_account_type_free(account_type_list);
_INFO("account_type_query_by_provider_feature end");
return ACCOUNT_ERROR_NONE;
}