mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
(menu_displaylist.c) Cut down on snprintfs
This commit is contained in:
parent
77ba2d254e
commit
20b496858f
@ -116,35 +116,43 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(tmp, sizeof(tmp), "Core name: %s",
|
strlcpy(tmp, "Core name", sizeof(tmp));
|
||||||
core_info->core_name ? core_info->core_name : "");
|
strlcat(tmp, ": ", sizeof(tmp));
|
||||||
|
if (core_info->core_name)
|
||||||
|
strlcat(tmp, core_info->core_name, sizeof(tmp));
|
||||||
|
|
||||||
menu_list_push(info->list, tmp, "",
|
menu_list_push(info->list, tmp, "",
|
||||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||||
|
|
||||||
snprintf(tmp, sizeof(tmp), "Core label: %s",
|
strlcpy(tmp, "Core label", sizeof(tmp));
|
||||||
core_info->display_name ? core_info->display_name : "");
|
strlcat(tmp, ": ", sizeof(tmp));
|
||||||
|
if (core_info->display_name)
|
||||||
|
strlcat(tmp, core_info->display_name, sizeof(tmp));
|
||||||
menu_list_push(info->list, tmp, "",
|
menu_list_push(info->list, tmp, "",
|
||||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||||
|
|
||||||
if (core_info->systemname)
|
if (core_info->systemname)
|
||||||
{
|
{
|
||||||
snprintf(tmp, sizeof(tmp), "System name: %s",
|
strlcpy(tmp, "System name", sizeof(tmp));
|
||||||
core_info->systemname);
|
strlcat(tmp, ": ", sizeof(tmp));
|
||||||
|
strlcat(tmp, core_info->systemname, sizeof(tmp));
|
||||||
menu_list_push(info->list, tmp, "",
|
menu_list_push(info->list, tmp, "",
|
||||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (core_info->system_manufacturer)
|
if (core_info->system_manufacturer)
|
||||||
{
|
{
|
||||||
snprintf(tmp, sizeof(tmp), "System manufacturer: %s",
|
strlcpy(tmp, "System manufacturer", sizeof(tmp));
|
||||||
core_info->system_manufacturer);
|
strlcat(tmp, ": ", sizeof(tmp));
|
||||||
|
strlcat(tmp, core_info->system_manufacturer, sizeof(tmp));
|
||||||
menu_list_push(info->list, tmp, "",
|
menu_list_push(info->list, tmp, "",
|
||||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (core_info->categories_list)
|
if (core_info->categories_list)
|
||||||
{
|
{
|
||||||
strlcpy(tmp, "Categories: ", sizeof(tmp));
|
strlcpy(tmp, "Categories", sizeof(tmp));
|
||||||
|
strlcat(tmp, ": ", sizeof(tmp));
|
||||||
string_list_join_concat(tmp, sizeof(tmp),
|
string_list_join_concat(tmp, sizeof(tmp),
|
||||||
core_info->categories_list, ", ");
|
core_info->categories_list, ", ");
|
||||||
menu_list_push(info->list, tmp, "",
|
menu_list_push(info->list, tmp, "",
|
||||||
@ -153,7 +161,8 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info)
|
|||||||
|
|
||||||
if (core_info->authors_list)
|
if (core_info->authors_list)
|
||||||
{
|
{
|
||||||
strlcpy(tmp, "Authors: ", sizeof(tmp));
|
strlcpy(tmp, "Authors", sizeof(tmp));
|
||||||
|
strlcat(tmp, ": ", sizeof(tmp));
|
||||||
string_list_join_concat(tmp, sizeof(tmp),
|
string_list_join_concat(tmp, sizeof(tmp),
|
||||||
core_info->authors_list, ", ");
|
core_info->authors_list, ", ");
|
||||||
menu_list_push(info->list, tmp, "",
|
menu_list_push(info->list, tmp, "",
|
||||||
@ -162,7 +171,8 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info)
|
|||||||
|
|
||||||
if (core_info->permissions_list)
|
if (core_info->permissions_list)
|
||||||
{
|
{
|
||||||
strlcpy(tmp, "Permissions: ", sizeof(tmp));
|
strlcpy(tmp, "Permissions", sizeof(tmp));
|
||||||
|
strlcat(tmp, ": ", sizeof(tmp));
|
||||||
string_list_join_concat(tmp, sizeof(tmp),
|
string_list_join_concat(tmp, sizeof(tmp),
|
||||||
core_info->permissions_list, ", ");
|
core_info->permissions_list, ", ");
|
||||||
menu_list_push(info->list, tmp, "",
|
menu_list_push(info->list, tmp, "",
|
||||||
@ -171,7 +181,8 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info)
|
|||||||
|
|
||||||
if (core_info->licenses_list)
|
if (core_info->licenses_list)
|
||||||
{
|
{
|
||||||
strlcpy(tmp, "License(s): ", sizeof(tmp));
|
strlcpy(tmp, "License(s)", sizeof(tmp));
|
||||||
|
strlcat(tmp, ": ", sizeof(tmp));
|
||||||
string_list_join_concat(tmp, sizeof(tmp),
|
string_list_join_concat(tmp, sizeof(tmp),
|
||||||
core_info->licenses_list, ", ");
|
core_info->licenses_list, ", ");
|
||||||
menu_list_push(info->list, tmp, "",
|
menu_list_push(info->list, tmp, "",
|
||||||
@ -180,7 +191,8 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info)
|
|||||||
|
|
||||||
if (core_info->supported_extensions_list)
|
if (core_info->supported_extensions_list)
|
||||||
{
|
{
|
||||||
strlcpy(tmp, "Supported extensions: ", sizeof(tmp));
|
strlcpy(tmp, "Supported extensions", sizeof(tmp));
|
||||||
|
strlcat(tmp, ": ", sizeof(tmp));
|
||||||
string_list_join_concat(tmp, sizeof(tmp),
|
string_list_join_concat(tmp, sizeof(tmp),
|
||||||
core_info->supported_extensions_list, ", ");
|
core_info->supported_extensions_list, ", ");
|
||||||
menu_list_push(info->list, tmp, "",
|
menu_list_push(info->list, tmp, "",
|
||||||
@ -218,14 +230,15 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info)
|
|||||||
|
|
||||||
if (core_info->notes)
|
if (core_info->notes)
|
||||||
{
|
{
|
||||||
snprintf(tmp, sizeof(tmp), "Core notes: ");
|
strlcpy(tmp, "Core notes", sizeof(tmp));
|
||||||
|
strlcat(tmp, ": ", sizeof(tmp));
|
||||||
menu_list_push(info->list, tmp, "",
|
menu_list_push(info->list, tmp, "",
|
||||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||||
|
|
||||||
for (i = 0; i < core_info->note_list->size; i++)
|
for (i = 0; i < core_info->note_list->size; i++)
|
||||||
{
|
{
|
||||||
snprintf(tmp, sizeof(tmp), " %s",
|
strlcpy(tmp,
|
||||||
core_info->note_list->elems[i].data);
|
core_info->note_list->elems[i].data, sizeof(tmp));
|
||||||
menu_list_push(info->list, tmp, "",
|
menu_list_push(info->list, tmp, "",
|
||||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user