From: Yunjin Lee Date: Tue, 12 Jul 2016 07:43:31 +0000 (+0900) Subject: Revise internal apis : Remove useless things X-Git-Tag: submit/tizen/20160713.072327^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=568d31432e645c529d8097b6909b1c18e43e3641;p=platform%2Fcore%2Fsecurity%2Fprivilege-info.git Revise internal apis : Remove useless things Change-Id: Id19507e28e20dd7875b14ab58e8c440c65297e8f Signed-off-by: Yunjin Lee --- diff --git a/src/privilege_info.c b/src/privilege_info.c index 5406c20..6f17e30 100755 --- a/src/privilege_info.c +++ b/src/privilege_info.c @@ -24,58 +24,60 @@ typedef enum { PRVINFO_ERROR_NO_MATCHING_PRIVILEGE = TIZEN_ERROR_PRIVILEGE_INFORMATION | 0x01 } privilege_info_internal_error_e; -int privilege_info_get_display_name_string_id(const char* api_version, const char *privilege, char **display_name_string_id) +int privilege_info_get_string_id(const char* package_type_string, int display, const char* api_version, const char *privilege, char **string_id) { TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL"); TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL"); char* temp = NULL; + int ret; + privilege_db_manager_package_type_e package_type; + + if (package_type_string != NULL) + goto get_string_id_with_package_type; /* Check NATIVE */ - int ret = privilege_db_manager_get_privilege_display(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_CORE, privilege, api_version, &temp); - - if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) { - if (temp == NULL) - *display_name_string_id = NULL; - else if (strcmp(temp, "") == 0) - *display_name_string_id = NULL; - else - goto err_none; - } else if (ret != PRIVILEGE_DB_NO_EXIST_RESULT) { + if (display) + ret = privilege_db_manager_get_privilege_display(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_CORE, privilege, api_version, &temp); + else + ret = privilege_db_manager_get_privilege_description(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_CORE, privilege, api_version, &temp); + + if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) + goto err_none; + else if (ret != PRIVILEGE_DB_NO_EXIST_RESULT) goto err_internal_error; - } - - if (temp != NULL) { - free(temp); - temp = NULL; - } /* Check WEB */ - ret = privilege_db_manager_get_privilege_display(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_WRT, privilege, api_version, &temp); - - if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) { - if (temp == NULL) - goto err_no_matching_privilege; - else if (strcmp(temp, "") == 0) - goto err_no_matching_privilege; - else - goto err_none; - } else if (ret == PRIVILEGE_DB_NO_EXIST_RESULT) { + +get_string_id_with_package_type: + if (package_type_string == NULL || strcmp(package_type_string, "PRVINFO_PACKAGE_TYPE_WEB") == 0) + package_type = PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_WRT; + else if (strcmp(package_type_string, "PRVINFO_PACKAGE_TYPE_NATIVE") == 0) + package_type = PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_CORE; + else + return PRVINFO_ERROR_INVALID_PARAMETER; + + if (display) + ret = privilege_db_manager_get_privilege_display(package_type, privilege, api_version, &temp); + else + ret = privilege_db_manager_get_privilege_description(package_type, privilege, api_version, &temp); + + + if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) + goto err_none; + else if (ret == PRIVILEGE_DB_NO_EXIST_RESULT) goto err_no_matching_privilege; - } else { + else goto err_internal_error; - } err_none: - *display_name_string_id = (char*)calloc(strlen(temp) + 1, sizeof(char)); - TryReturn(*display_name_string_id != NULL, free(temp), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation is failed."); - memcpy(*display_name_string_id, temp, strlen(temp)); - LOGD("display_name_string_id = %s", *display_name_string_id); + *string_id = strdup(temp); + TryReturn(*string_id != NULL, free(temp), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation is failed."); free(temp); return PRVINFO_ERROR_NONE; err_no_matching_privilege: - *display_name_string_id = NULL; + *string_id = NULL; free(temp); return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE; @@ -84,18 +86,15 @@ err_internal_error: return PRVINFO_ERROR_INTERNAL_ERROR; } - -int privilege_info_get_display_name_by_string_id(const char *string_id, char **display_name) +int privilege_info_get_string_by_string_id(const char *string_id, char **string) { char *temp = NULL; TryReturn(string_id != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] string_id is NULL"); temp = dgettext("privilege", string_id); - *display_name = (char*)calloc(strlen(temp) + 1, sizeof(char)); - TryReturn(*display_name != NULL, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed."); - - memcpy(*display_name, temp, strlen(temp)); + *string = strdup(temp); + TryReturn(*string != NULL, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] strdup of string failed."); return PRVINFO_ERROR_NONE; } @@ -104,12 +103,12 @@ PI_API int privilege_info_get_display_name(const char* api_version, const char* privilege, char** display_name) { int ret = 0; - char* display_name_string_id = NULL; + char* string_id = NULL; TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL"); TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL"); - ret = privilege_info_get_display_name_string_id(api_version, privilege, &display_name_string_id); + ret = privilege_info_get_string_id(NULL, 1, api_version, privilege, &string_id); if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) { char* tempPrivilege = NULL; @@ -125,13 +124,12 @@ int privilege_info_get_display_name(const char* api_version, const char* privile temp = token; token = strtok_r(NULL, "/", &save); } - *display_name = (char*)calloc(strlen(temp) + 1, sizeof(char)); + *display_name = strdup(temp); TryReturn(*display_name != NULL, free(tempPrivilege), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed."); - memcpy(*display_name, temp, strlen(temp)); free(tempPrivilege); } else if (ret == PRVINFO_ERROR_NONE) { - ret = privilege_info_get_display_name_by_string_id(display_name_string_id, display_name); - free(display_name_string_id); + ret = privilege_info_get_string_by_string_id(string_id, display_name); + free(string_id); TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed."); } else { return PRVINFO_ERROR_INTERNAL_ERROR; @@ -140,101 +138,23 @@ int privilege_info_get_display_name(const char* api_version, const char* privile } -int privilege_info_get_description_string_id(const char* api_version, const char *privilege, char **description_string_id) -{ - TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL"); - TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL"); - - char* temp = NULL; - - /* Check NATIVE */ - int ret = privilege_db_manager_get_privilege_description(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_CORE, privilege, api_version, &temp); - - if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) { - if (temp == NULL) - *description_string_id = NULL; - else if (strcmp(temp, "") == 0) - *description_string_id = NULL; - else - goto err_none; - } else if (ret != PRIVILEGE_DB_NO_EXIST_RESULT) { - goto err_internal_error; - } - - if (temp != NULL) { - free(temp); - temp = NULL; - } - /* Check WEB */ - ret = privilege_db_manager_get_privilege_description(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_WRT, privilege, api_version, &temp); - - if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) { - if (temp == NULL) - goto err_no_matching_privilege; - else if (strcmp(temp, "") == 0) - goto err_no_matching_privilege; - else - goto err_none; - } else if (ret == PRIVILEGE_DB_NO_EXIST_RESULT) { - goto err_no_matching_privilege; - } else { - goto err_internal_error; - } - -err_none: - *description_string_id = (char*)calloc(strlen(temp) + 1, sizeof(char)); - TryReturn(*description_string_id != NULL, free(temp), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation is failed."); - memcpy(*description_string_id, temp, strlen(temp)); - LOGD("description_string_id = %s", *description_string_id); - free(temp); - return PRVINFO_ERROR_NONE; - -err_no_matching_privilege: - *description_string_id = NULL; - free(temp); - return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE; - -err_internal_error: - free(temp); - return PRVINFO_ERROR_INTERNAL_ERROR; -} - -int privilege_info_get_description_by_string_id(const char *string_id, char **description) -{ - char *temp = NULL; - TryReturn(string_id != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] string_id is NULL"); - - temp = dgettext("privilege", string_id); - - *description = (char*)calloc(strlen(temp) + 1, sizeof(char)); - TryReturn(*description != NULL, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed."); - - memcpy(*description, temp, strlen(temp)); - - return PRVINFO_ERROR_NONE; -} - PI_API int privilege_info_get_description(const char* api_version, const char* privilege, char** description) { int ret = 0; - char* description_string_id = NULL; + char* string_id = NULL; TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL"); TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL"); - ret = privilege_info_get_description_string_id(api_version, privilege, &description_string_id); + ret = privilege_info_get_string_id(NULL, 0, api_version, privilege, &string_id); if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) { - char* temp = NULL; - temp = dgettext("privilege", "IDS_TPLATFORM_BODY_THIS_PRIVILEGE_IS_NOT_DEFINED"); - *description = (char*)calloc(strlen(temp) + 1, sizeof(char)); - TryReturn(*description != NULL, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed."); - - memcpy(*description, temp, strlen(temp)); + ret = privilege_info_get_string_by_string_id("IDS_TPLATFORM_BODY_THIS_PRIVILEGE_IS_NOT_DEFINED", description); + TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed."); } else if (ret == PRVINFO_ERROR_NONE) { - ret = privilege_info_get_description_by_string_id(description_string_id, description); - free(description_string_id); + ret = privilege_info_get_string_by_string_id(string_id, description); + free(string_id); TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed."); } else { return PRVINFO_ERROR_INTERNAL_ERROR; @@ -242,90 +162,20 @@ int privilege_info_get_description(const char* api_version, const char* privileg return PRVINFO_ERROR_NONE; } -int privilege_info_get_display_name_string_id_by_pkgtype(const char* package_type, const char* api_version, const char *privilege, char **display_name_string_id) -{ - TryReturn(package_type != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] package_type is NULL"); - TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL"); - TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL"); - - char* temp = NULL; - - /* Check package_type */ - int ret = 0; - if (strcmp(package_type, "PRVINFO_PACKAGE_TYPE_NATIVE") == 0) { - LOGD("package_type = %s", package_type); - } else if (strcmp(package_type, "PRVINFO_PACKAGE_TYPE_WEB") == 0) { - LOGD("package_type = %s", package_type); - ret = privilege_db_manager_get_privilege_display(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_WRT, privilege, api_version, &temp); - if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) { - if (temp == NULL) - *display_name_string_id = NULL; - else if (strcmp(temp, "") == 0) - *display_name_string_id = NULL; - else - goto err_none; - } else if (ret != PRIVILEGE_DB_NO_EXIST_RESULT) { - goto err_internal_error; - } - - if (temp != NULL) { - free(temp); - temp = NULL; - } - } else { - LOGD("package_type = %s", package_type); - free(temp); - return PRVINFO_ERROR_INVALID_PARAMETER; - } - - ret = privilege_db_manager_get_privilege_display(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_CORE, privilege, api_version, &temp); - - if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) { - if (temp == NULL) - goto err_no_matching_privilege; - else if (strcmp(temp, "") == 0) - goto err_no_matching_privilege; - else - goto err_none; - } else if (ret == PRIVILEGE_DB_NO_EXIST_RESULT) { - goto err_no_matching_privilege; - } else { - goto err_internal_error; - } - -err_none: - *display_name_string_id = (char*)calloc(strlen(temp) + 1, sizeof(char)); - TryReturn(*display_name_string_id != NULL, free(temp), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation is failed."); - memcpy(*display_name_string_id, temp, strlen(temp)); - LOGD("display_name_string_id = %s", *display_name_string_id); - free(temp); - return PRVINFO_ERROR_NONE; - -err_no_matching_privilege: - *display_name_string_id = NULL; - free(temp); - return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE; - -err_internal_error: - free(temp); - return PRVINFO_ERROR_INTERNAL_ERROR; -} - PI_API int privilege_info_get_display_name_by_pkgtype(const const char* package_type, const char* api_version, const char* privilege, char** display_name) { int ret = 0; - char* display_name_string_id = NULL; + char* string_id = NULL; TryReturn(package_type != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] package_type is NULL"); TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL"); TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL"); - ret = privilege_info_get_display_name_string_id_by_pkgtype(package_type, api_version, privilege, &display_name_string_id); + ret = privilege_info_get_string_id(package_type, 1, api_version, privilege, &string_id); + TryReturn(ret != PRVINFO_ERROR_INVALID_PARAMETER, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] invalid package_type : %s", package_type); - if (ret == PRVINFO_ERROR_INVALID_PARAMETER) { - return ret; - } else if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) { + if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) { char* tempPrivilege = NULL; char* token = NULL; char* temp = NULL; @@ -337,13 +187,12 @@ int privilege_info_get_display_name_by_pkgtype(const const char* package_type, c temp = token; token = strtok_r(NULL, "/", &save); } - *display_name = (char*)calloc(strlen(temp) + 1, sizeof(char)); + *display_name = strdup(temp); TryReturn(*display_name != NULL, free(tempPrivilege), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed."); - memcpy(*display_name, temp, strlen(temp)); free(tempPrivilege); } else if (ret == PRVINFO_ERROR_NONE) { - ret = privilege_info_get_display_name_by_string_id(display_name_string_id, display_name); - free(display_name_string_id); + ret = privilege_info_get_string_by_string_id(string_id, display_name); + free(string_id); TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed."); } else { return PRVINFO_ERROR_INTERNAL_ERROR; @@ -351,102 +200,25 @@ int privilege_info_get_display_name_by_pkgtype(const const char* package_type, c return PRVINFO_ERROR_NONE; } - -int privilege_info_get_description_string_id_by_pkgtype(const char* package_type, const char* api_version, const char *privilege, char **description_string_id) -{ - TryReturn(package_type != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] package_type is NULL"); - TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL"); - TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL"); - - char* temp = NULL; - - /* Check package_type */ - int ret = 0; - - if (strcmp(package_type, "PRVINFO_PACKAGE_TYPE_WEB") == 0) { - LOGD("package_type = %s", package_type); - ret = privilege_db_manager_get_privilege_description(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_WRT, privilege, api_version, &temp); - if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) { - if (temp == NULL) - *description_string_id = NULL; - else if (strcmp(temp, "") == 0) - *description_string_id = NULL; - else - goto err_none; - } else if (ret != PRIVILEGE_DB_NO_EXIST_RESULT) { - goto err_internal_error; - } - - if (temp != NULL) { - free(temp); - temp = NULL; - } - } else if (strcmp(package_type, "PRVINFO_PACKAGE_TYPE_NATIVE") == 0) { - LOGD("package_type = %s", package_type); - } else { - LOGD("package_type = %s", package_type); - free(temp); - return PRVINFO_ERROR_INVALID_PARAMETER; - } - - ret = privilege_db_manager_get_privilege_description(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_CORE, privilege, api_version, &temp); - - if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) { - if (temp == NULL) - goto err_no_matching_privilege; - else if (strcmp(temp, "") == 0) - goto err_no_matching_privilege; - else - goto err_none; - } else if (ret == PRIVILEGE_DB_NO_EXIST_RESULT) { - goto err_no_matching_privilege; - } else { - goto err_internal_error; - } - - -err_none: - *description_string_id = (char*)calloc(strlen(temp) + 1, sizeof(char)); - TryReturn(*description_string_id != NULL, free(temp), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation is failed."); - memcpy(*description_string_id, temp, strlen(temp)); - LOGD("description_string_id = %s", *description_string_id); - free(temp); - return PRVINFO_ERROR_NONE; - -err_no_matching_privilege: - *description_string_id = NULL; - free(temp); - return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE; - -err_internal_error: - free(temp); - return PRVINFO_ERROR_INTERNAL_ERROR; -} - PI_API int privilege_info_get_description_by_pkgtype(const char* package_type, const char* api_version, const char* privilege, char** description) { int ret = 0; - char* description_string_id = NULL; + char* string_id = NULL; TryReturn(package_type != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] package_type is NULL"); TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL"); TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL"); - ret = privilege_info_get_description_string_id_by_pkgtype(package_type, api_version, privilege, &description_string_id); + ret = privilege_info_get_string_id(package_type, 0, api_version, privilege, &string_id); + TryReturn(ret != PRVINFO_ERROR_INVALID_PARAMETER, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] invalid package_type : %s", package_type); - if (ret == PRVINFO_ERROR_INVALID_PARAMETER) { - return ret; - } else if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) { - char* temp = NULL; - temp = dgettext("privilege", "IDS_TPLATFORM_BODY_THIS_PRIVILEGE_IS_NOT_DEFINED"); - *description = (char*)calloc(strlen(temp) + 1, sizeof(char)); - TryReturn(*description != NULL, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed."); - memcpy(*description, temp, strlen(temp)); - /* return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE; */ + if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) { + ret = privilege_info_get_string_by_string_id("IDS_TPLATFORM_BODY_THIS_PRIVILEGE_IS_NOT_DEFINED", description); + TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed."); } else if (ret == PRVINFO_ERROR_NONE) { - ret = privilege_info_get_description_by_string_id(description_string_id, description); - free(description_string_id); + ret = privilege_info_get_string_by_string_id(string_id, description); + free(string_id); TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed."); } else { return PRVINFO_ERROR_INTERNAL_ERROR;