Revert "Remove core_info_list_num_info_files"

This reverts commit 9d96e9e452.
This commit is contained in:
twinaphex 2016-02-11 07:20:04 +01:00
parent 8a043a9c6d
commit 36b420ec17
4 changed files with 24 additions and 12 deletions

View File

@ -207,8 +207,8 @@ void core_info_get_name(const char *path, char *s, size_t len)
if (!core_info)
goto error;
core_info_list->list = core_info;
core_info_list->count = 0;
core_info_list->list = core_info;
core_info_list->count = contents->size;
for (i = 0; i < contents->size; i++)
{
@ -231,13 +231,6 @@ void core_info_get_name(const char *path, char *s, size_t len)
strlcpy(s, core_info[i].core_name, len);
}
for (i = 0; i < contents->size; i++)
{
config_file_t *conf = (config_file_t*)
core_info_list->list[i].config_data;
core_info_list->count += !!conf;
}
error:
if (contents)
dir_list_free(contents);
@ -353,6 +346,24 @@ error:
return NULL;
}
size_t core_info_list_num_info_files(core_info_list_t *core_info_list)
{
size_t i, num = 0;
if (!core_info_list)
return 0;
for (i = 0; i < core_info_list->count; i++)
{
config_file_t *conf = (config_file_t*)
core_info_list->list[i].config_data;
num += !!conf;
}
return num;
}
bool core_info_list_get_display_name(core_info_list_t *core_info_list,
const char *path, char *s, size_t len)
{

View File

@ -96,6 +96,8 @@ typedef struct core_info_ctx_find
const char *path;
} core_info_ctx_find_t;
size_t core_info_list_num_info_files(core_info_list_t *list);
/* Non-reentrant, does not allocate. Returns pointer to internal state. */
void core_info_list_get_supported_cores(core_info_list_t *list,
const char *path, const core_info_t **infos, size_t *num_infos);

View File

@ -1375,8 +1375,7 @@ static int mui_list_push(void *data, void *userdata,
MENU_SETTING_ACTION, 0, 0);
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
if (list->count > 0)
if (core_info_list_num_info_files(list))
{
menu_entries_push(info->list,
menu_hash_to_str(MENU_LABEL_VALUE_DETECT_CORE_LIST),

View File

@ -2960,7 +2960,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
menu_hash_to_str(MENU_LABEL_LOAD_CONTENT),
MENU_SETTING_ACTION, 0, 0);
if (list->count > 0)
if (core_info_list_num_info_files(list))
{
menu_entries_push(info->list,
menu_hash_to_str(MENU_LABEL_VALUE_DETECT_CORE_LIST),