Skip to content

Commit

Permalink
Revert "Remove core_info_list_num_info_files"
Browse files Browse the repository at this point in the history
This reverts commit 9d96e9e.
  • Loading branch information
inactive123 committed Feb 11, 2016
1 parent 8a043a9 commit 36b420e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
29 changes: 20 additions & 9 deletions core_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand All @@ -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);
Expand Down Expand Up @@ -353,6 +346,24 @@ static core_info_list_t *core_info_list_new(void)
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)
{
Expand Down
2 changes: 2 additions & 0 deletions core_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions menu/drivers/materialui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion menu/menu_displaylist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 36b420e

Please sign in to comment.