Get rid of more instances of string_list in menu code

This commit is contained in:
libretroadmin 2024-06-15 07:06:36 +02:00
parent 7d1d8be14e
commit 9e71a566cc
3 changed files with 43 additions and 41 deletions

View File

@ -16,7 +16,6 @@
#include <file/file_path.h>
#include <compat/strl.h>
#include <string/stdstring.h>
#include <lists/string_list.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"

View File

@ -15,7 +15,6 @@
#include <compat/strl.h>
#include <file/file_path.h>
#include <lists/string_list.h>
#include <string/stdstring.h>
#ifdef HAVE_CONFIG_H

View File

@ -82,12 +82,14 @@ static int menu_action_sublabel_file_browser_core(file_list_t *list, unsigned ty
core_info_find(path, &core_info)
&& core_info->licenses_list)
{
char tmp[MENU_SUBLABEL_MAX_LENGTH];
tmp[0] = '\0';
unsigned i;
/* Add license text */
string_list_join_concat(tmp, sizeof(tmp),
core_info->licenses_list, ", ");
strlcpy(s + _len, tmp, len - _len);
for (i = 0; i < core_info->licenses_list->size; i++)
{
_len += strlcpy(s + _len, core_info->licenses_list->elems[i].data, len - _len);
if ((i + 1) < core_info->licenses_list->size)
_len += strlcpy(s + _len, ", ", len - _len);
}
}
else /* No license found - set to N/A */
strlcpy(s + _len, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len - _len);
@ -2078,12 +2080,14 @@ static int action_bind_sublabel_core_updater_entry(
&& core_updater_list_get_filename(core_list, path, &entry)
&& entry->licenses_list)
{
char tmp[MENU_SUBLABEL_MAX_LENGTH];
tmp[0] = '\0';
unsigned i;
/* Add license text */
string_list_join_concat(tmp, sizeof(tmp),
entry->licenses_list, ", ");
strlcpy(s + _len, tmp, len - _len);
for (i = 0; i < entry->licenses_list->size; i++)
{
_len += strlcpy(s + _len, entry->licenses_list->elems[i].data, len - _len);
if ((i + 1) < entry->licenses_list->size)
_len += strlcpy(s + _len, ", ", len - _len);
}
}
else /* No license found - set to N/A */
strlcpy(s + _len, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len - _len);