Fix app_info_foreach_category and related functions 21/125321/3
authorJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 17 Apr 2017 02:01:47 +0000 (11:01 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 17 Apr 2017 07:20:13 +0000 (00:20 -0700)
- Remove duplicated functions
- Fix typo error

Change-Id: I54653dfeddf4a4efc0177826e8fbe6911e301ef5
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/app_info.c

index 7de31cbac6e6a0ae63bdbc4890374fdc36147d2a..ab422d2ecad8659bb083dad8c4221a1025f2f08f 100644 (file)
@@ -169,22 +169,7 @@ static int app_info_foreach_app_metadata_cb(const char *metadata_key, const char
                return PMINFO_R_ERROR;
 }
 
-static int app_info_foreach_caregory_cb(const char *category_name, void *user_data)
-{
-       foreach_category_context_s *foreach_category = user_data;
-       bool iteration_next = true;
-
-       if (category_name == NULL || foreach_category == NULL)
-               return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
-
-       iteration_next = foreach_category->callback(category_name, foreach_category->user_data);
-       if (iteration_next == true)
-               return PMINFO_R_OK;
-       else
-               return PMINFO_R_ERROR;
-}
-
-static int app_info_foreach_caregory_cb(const char *category_name, void *user_data)
+static int app_info_foreach_category_cb(const char *category_name, void *user_data)
 {
        foreach_category_context_s *foreach_category = user_data;
        bool iteration_next = true;
@@ -666,7 +651,7 @@ API int app_info_foreach_category(app_info_h app_info, app_info_category_cb call
                .user_data = user_data,
        };
 
-       retval = pkgmgrinfo_appinfo_foreach_category(app_info->pkg_app_info, app_info_foreach_caregory_cb, &foreach_category);
+       retval = pkgmgrinfo_appinfo_foreach_category(app_info->pkg_app_info, app_info_foreach_category_cb, &foreach_category);
        if (retval != PMINFO_R_OK)
                return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
 
@@ -785,28 +770,6 @@ API int app_info_filter_foreach_appinfo(app_info_filter_h handle, app_info_filte
        return APP_MANAGER_ERROR_NONE;
 }
 
-API int app_info_foreach_category(app_info_h app_info, app_info_category_cb callback, void *user_data)
-{
-       int retval;
-       if (app_info == NULL || callback == NULL)
-               return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
-       retval = _check_privilege(PRIVILEGE_PACKAGE_MANAGER_ADMIN);
-       if (retval != APP_MANAGER_ERROR_NONE)
-               return app_manager_error(APP_MANAGER_ERROR_PERMISSION_DENIED, __FUNCTION__, NULL);
-
-       foreach_category_context_s foreach_category = {
-               .callback = callback,
-               .user_data = user_data,
-       };
-
-       retval = pkgmgrinfo_appinfo_foreach_category(app_info->pkg_app_info, app_info_foreach_caregory_cb, &foreach_category);
-       if (retval != PMINFO_R_OK)
-               return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
-
-       return APP_MANAGER_ERROR_NONE;
-}
-
 API int app_info_metadata_filter_create(app_info_metadata_filter_h *handle)
 {
        int retval = 0;