diff options
Diffstat (limited to 'src/user-awareness-users.c')
-rwxr-xr-x | src/user-awareness-users.c | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/src/user-awareness-users.c b/src/user-awareness-users.c index 013a4d5..3422da7 100755 --- a/src/user-awareness-users.c +++ b/src/user-awareness-users.c @@ -135,31 +135,37 @@ int _ua_user_add_info_to_list_from_uapi_data(uam_user_info_s *uam_info) UA_VALIDATE_INPUT_PARAMETER(uam_info); if (NULL != _ua_get_user_from_list(uam_info->account)) { - UA_INFO("User already in list [%s]", uam_info->account); - return UA_ERROR_NONE; + UA_INFO("User already in list [%s]", uam_info->account); + return UA_ERROR_NONE; } user_info = g_malloc0(sizeof(ua_user_info_s)); if (!user_info) { + /* LCOV_EXCL_START */ UA_ERR("g_malloc0 failed"); return UA_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } user_info->account = g_strdup(uam_info->account); if (user_info->account == NULL) { + /* LCOV_EXCL_START */ UA_ERR("g_malloc0 failed"); _ua_free_ua_user_info_t(user_info); return UA_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } user_info->name = g_strdup(uam_info->name); if (user_info->name == NULL) { + /* LCOV_EXCL_START */ UA_ERR("g_malloc0 failed"); _ua_free_ua_user_info_t(user_info); return UA_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } user_info->isadded = true; @@ -230,6 +236,7 @@ int _ua_user_add_info_to_list(ua_user_info_s* ua_info) return UA_ERROR_NONE; } +/* LCOV_EXCL_START */ int _ua_remove_user_info_from_list(char *account) { FUNC_ENTRY; @@ -264,6 +271,7 @@ int _ua_remove_user_info_from_list(char *account) FUNC_EXIT; return ret; } +/* LCOV_EXCL_STOP */ ua_user_h _ua_get_user_handle_by_account(const char *account) { @@ -272,8 +280,10 @@ ua_user_h _ua_get_user_handle_by_account(const char *account) ua_user_info_s *u; if (account == NULL) { + /* LCOV_EXCL_START */ UA_INFO("Account is NULL"); return NULL; + /* LCOV_EXCL_STOP */ } for (l = ua_users_list; l; l = g_slist_next(l)) { @@ -327,8 +337,8 @@ int _ua_intr_get_default_user(ua_user_h *user_handle) /* LCOV_EXCL_START */ UA_ERR("Failed with error: %s(0x%X)", _ua_get_error_string(ret), ret); - /* LCOV_EXCL_STOP */ goto done; + /* LCOV_EXCL_STOP */ } for (l = ua_users_list; l; l = g_slist_next(l)) { @@ -477,6 +487,7 @@ int ua_user_create(const char *account, return UA_ERROR_NONE; } +/* LCOV_EXCL_START */ int ua_user_clone(ua_user_h *cloned, ua_user_h origin) { FUNC_ENTRY; @@ -491,10 +502,8 @@ int ua_user_clone(ua_user_h *cloned, ua_user_h origin) user_dst = g_malloc0(sizeof(ua_user_info_s)); if (!user_dst) { - /* LCOV_EXCL_START */ UA_ERR("g_malloc0 failed"); return UA_ERROR_OUT_OF_MEMORY; - /* LCOV_EXCL_STOP */ } user_dst->state = user_src->state; user_dst->sensor_bitmask = user_src->sensor_bitmask; @@ -504,20 +513,16 @@ int ua_user_clone(ua_user_h *cloned, ua_user_h origin) user_dst->name = g_strdup(user_src->name); if (!user_dst->name) { - /* LCOV_EXCL_START */ g_free(user_dst); UA_ERR("g_malloc0 failed"); return UA_ERROR_OUT_OF_MEMORY; - /* LCOV_EXCL_STOP */ } user_dst->account = g_strdup(user_src->account); if (!user_dst->account) { - /* LCOV_EXCL_START */ g_free(user_dst->name); g_free(user_dst); UA_ERR("g_malloc0 failed"); return UA_ERROR_OUT_OF_MEMORY; - /* LCOV_EXCL_STOP */ } /* Add user to list of users*/ @@ -527,6 +532,7 @@ int ua_user_clone(ua_user_h *cloned, ua_user_h origin) FUNC_EXIT; return UA_ERROR_NONE; } +/* LCOV_EXCL_STOP */ int ua_user_add(ua_user_h user_handle) { @@ -597,6 +603,7 @@ int ua_user_remove(ua_user_h user_handle) return UA_ERROR_NONE; } +/* LCOV_EXCL_START */ int ua_user_get_default_user(ua_user_h *user_handle) { FUNC_ENTRY; @@ -645,16 +652,15 @@ int ua_user_set_account(ua_user_h user_handle, const char *account) UA_ERROR_INVALID_PARAMETER); if (user->account) { - /* LCOV_EXCL_START */ g_free(user->account); user->account = NULL; - /* LCOV_EXCL_STOP */ } user->account = g_strdup(account); FUNC_EXIT; return UA_ERROR_NONE; } +/* LCOV_EXCL_STOP */ int ua_user_get_account(ua_user_h user_handle, char **account) { @@ -683,6 +689,7 @@ int ua_user_get_account(ua_user_h user_handle, char **account) return UA_ERROR_NONE; } +/* LCOV_EXCL_START */ int ua_user_set_name(ua_user_h user_handle, const char *name) { FUNC_ENTRY; @@ -725,6 +732,7 @@ int ua_user_get_handle_by_account(const char* account, FUNC_EXIT; return UA_ERROR_NONE; } +/* LCOV_EXCL_STOP */ int ua_user_destroy(ua_user_h user_handle) { @@ -754,6 +762,7 @@ int ua_user_destroy(ua_user_h user_handle) return UA_ERROR_NONE; } +/* LCOV_EXCL_START */ int ua_user_foreach_added(ua_registered_user_cb foreach_cb, void *user_data) { FUNC_ENTRY; @@ -783,6 +792,7 @@ int ua_foreach_users( FUNC_EXIT; return ret; } +/* LCOV_EXCL_STOP */ int ua_user_add_device(ua_user_h user_handle, ua_device_h device_handle, ua_user_device_added_cb callback, void *user_data) @@ -807,8 +817,10 @@ int ua_user_add_device(ua_user_h user_handle, ua_device_h device_handle, user_callback = _ua_get_user_callback(UA_USER_EVENT_DEVICE_ADDED, device->type); if (user_callback && user_callback != callback) { /* For same device type, allow if same callback is registered */ + /* LCOV_EXCL_START */ UA_INFO("Different callback is registered"); return UA_ERROR_NOW_IN_PROGRESS; + /* LCOV_EXCL_STOP */ } temp_handle = device->user; @@ -909,9 +921,11 @@ int ua_user_remove_device(ua_user_h user_handle, ua_device_h device_handle) ret = _ua_get_error_code(_uam_request_remove_device(user->account, &uam_device)); if (UA_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ UA_ERR("Failed with error: %s(0x%X)", _ua_get_error_string(ret), ret); return ret; + /* LCOV_EXCL_STOP */ } device->isadded = false; @@ -920,6 +934,7 @@ int ua_user_remove_device(ua_user_h user_handle, ua_device_h device_handle) return UA_ERROR_NONE; } +/* LCOV_EXCL_START */ int ua_user_remove_device_by_device_id( const char *device_id, ua_mac_type_e mac_type) { @@ -937,16 +952,15 @@ int ua_user_remove_device_by_device_id( device_id, mac_type)); if (UA_ERROR_NONE != ret) { - /* LCOV_EXCL_START */ UA_ERR("Failed with error: %s(0x%X)", _ua_get_error_string(ret), ret); - /* LCOV_EXCL_STOP */ return ret; } FUNC_EXIT; return UA_ERROR_NONE; } +/* LCOV_EXCL_STOP */ int ua_user_foreach_devices( ua_user_h user_handle, |