mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
Prefer to use string_split_noalloc
This commit is contained in:
parent
e67cdb39ae
commit
01e5ec94bb
@ -312,36 +312,33 @@ bool core_updater_list_get_core(
|
||||
static bool core_updater_list_set_date(
|
||||
core_updater_list_entry_t *entry, const char *date_str)
|
||||
{
|
||||
struct string_list *date_list = NULL;
|
||||
struct string_list date_list = {0};
|
||||
|
||||
if (!entry || string_is_empty(date_str))
|
||||
goto error;
|
||||
|
||||
/* Split date string into component values */
|
||||
date_list = string_split(date_str, "-");
|
||||
|
||||
if (!date_list)
|
||||
goto error;
|
||||
string_list_initialize(&date_list);
|
||||
if (!string_split_noalloc(&date_list, date_str, "-"))
|
||||
goto error;
|
||||
|
||||
/* Date string must have 3 values:
|
||||
* [year] [month] [day] */
|
||||
if (date_list->size < 3)
|
||||
if (date_list.size < 3)
|
||||
goto error;
|
||||
|
||||
/* Convert date string values */
|
||||
entry->date.year = string_to_unsigned(date_list->elems[0].data);
|
||||
entry->date.month = string_to_unsigned(date_list->elems[1].data);
|
||||
entry->date.day = string_to_unsigned(date_list->elems[2].data);
|
||||
entry->date.year = string_to_unsigned(date_list.elems[0].data);
|
||||
entry->date.month = string_to_unsigned(date_list.elems[1].data);
|
||||
entry->date.day = string_to_unsigned(date_list.elems[2].data);
|
||||
|
||||
/* Clean up */
|
||||
string_list_free(date_list);
|
||||
string_list_deinitialize(&date_list);
|
||||
|
||||
return true;
|
||||
|
||||
error:
|
||||
|
||||
if (date_list)
|
||||
string_list_free(date_list);
|
||||
string_list_deinitialize(&date_list);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -758,10 +755,9 @@ bool core_updater_list_parse_network_data(
|
||||
const char *network_buildbot_url,
|
||||
const char *data, size_t len)
|
||||
{
|
||||
struct string_list *network_core_list = NULL;
|
||||
struct string_list *network_core_entry_list = NULL;
|
||||
char *data_buf = NULL;
|
||||
size_t i;
|
||||
char *data_buf = NULL;
|
||||
struct string_list network_core_list = {0};
|
||||
|
||||
/* Sanity check */
|
||||
if (!core_list || string_is_empty(data) || (len < 1))
|
||||
@ -782,12 +778,11 @@ bool core_updater_list_parse_network_data(
|
||||
data_buf[len] = '\0';
|
||||
|
||||
/* Split network listing request into lines */
|
||||
network_core_list = string_split(data_buf, "\n");
|
||||
|
||||
if (!network_core_list)
|
||||
string_list_initialize(&network_core_list);
|
||||
if (!string_split_noalloc(&network_core_list, data_buf, "\n"))
|
||||
goto error;
|
||||
|
||||
if (network_core_list->size < 1)
|
||||
if (network_core_list.size < 1)
|
||||
goto error;
|
||||
|
||||
/* Temporary data buffer is no longer required */
|
||||
@ -795,15 +790,17 @@ bool core_updater_list_parse_network_data(
|
||||
data_buf = NULL;
|
||||
|
||||
/* Loop over lines */
|
||||
for (i = 0; i < network_core_list->size; i++)
|
||||
for (i = 0; i < network_core_list.size; i++)
|
||||
{
|
||||
const char *line = network_core_list->elems[i].data;
|
||||
struct string_list network_core_entry_list = {0};
|
||||
const char *line = network_core_list.elems[i].data;
|
||||
|
||||
if (string_is_empty(line))
|
||||
continue;
|
||||
|
||||
string_list_initialize(&network_core_entry_list);
|
||||
/* Split line into listings info components */
|
||||
network_core_entry_list = string_split(line, " ");
|
||||
string_split_noalloc(&network_core_entry_list, line, " ");
|
||||
|
||||
/* Parse listings info and add to core updater
|
||||
* list */
|
||||
@ -812,11 +809,10 @@ bool core_updater_list_parse_network_data(
|
||||
path_dir_libretro,
|
||||
path_libretro_info,
|
||||
network_buildbot_url,
|
||||
network_core_entry_list);
|
||||
&network_core_entry_list);
|
||||
|
||||
/* Clean up */
|
||||
string_list_free(network_core_entry_list);
|
||||
network_core_entry_list = NULL;
|
||||
string_list_deinitialize(&network_core_entry_list);
|
||||
}
|
||||
|
||||
/* Sanity check */
|
||||
@ -824,7 +820,7 @@ bool core_updater_list_parse_network_data(
|
||||
goto error;
|
||||
|
||||
/* Clean up */
|
||||
string_list_free(network_core_list);
|
||||
string_list_deinitialize(&network_core_list);
|
||||
|
||||
/* Sort completed list */
|
||||
core_updater_list_qsort(core_list);
|
||||
@ -832,12 +828,7 @@ bool core_updater_list_parse_network_data(
|
||||
return true;
|
||||
|
||||
error:
|
||||
|
||||
if (network_core_list)
|
||||
string_list_free(network_core_list);
|
||||
|
||||
if (network_core_entry_list)
|
||||
string_list_free(network_core_entry_list);
|
||||
string_list_deinitialize(&network_core_list);
|
||||
|
||||
if (data_buf)
|
||||
free(data_buf);
|
||||
|
@ -329,14 +329,18 @@ static int deferred_push_cursor_manager_list_generic(
|
||||
char query[PATH_MAX_LENGTH];
|
||||
int ret = -1;
|
||||
const char *path = info->path;
|
||||
struct string_list *str_list = path ? string_split(path, "|") : NULL;
|
||||
|
||||
if (!str_list)
|
||||
struct string_list str_list = {0};
|
||||
|
||||
if (!path)
|
||||
goto end;
|
||||
|
||||
string_list_initialize(&str_list);
|
||||
string_split_noalloc(&str_list, path, "|");
|
||||
|
||||
query[0] = '\0';
|
||||
|
||||
database_info_build_query_enum(query, sizeof(query), type, str_list->elems[0].data);
|
||||
database_info_build_query_enum(query, sizeof(query), type,
|
||||
str_list.elems[0].data);
|
||||
|
||||
if (string_is_empty(query))
|
||||
goto end;
|
||||
@ -348,14 +352,14 @@ static int deferred_push_cursor_manager_list_generic(
|
||||
if (!string_is_empty(info->path))
|
||||
free(info->path);
|
||||
|
||||
info->path = strdup(str_list->elems[1].data);
|
||||
info->path_b = strdup(str_list->elems[0].data);
|
||||
info->path = strdup(str_list.elems[1].data);
|
||||
info->path_b = strdup(str_list.elems[0].data);
|
||||
info->path_c = strdup(query);
|
||||
|
||||
ret = deferred_push_dlist(info, DISPLAYLIST_DATABASE_QUERY);
|
||||
|
||||
end:
|
||||
string_list_free(str_list);
|
||||
string_list_deinitialize(&str_list);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -375,43 +379,6 @@ GENERIC_DEFERRED_CURSOR_MANAGER(deferred_push_cursor_manager_list_deferred_query
|
||||
GENERIC_DEFERRED_CURSOR_MANAGER(deferred_push_cursor_manager_list_deferred_query_rdb_entry_origin, DATABASE_QUERY_ENTRY_ORIGIN)
|
||||
GENERIC_DEFERRED_CURSOR_MANAGER(deferred_push_cursor_manager_list_deferred_query_rdb_entry_releasemonth, DATABASE_QUERY_ENTRY_RELEASEDATE_MONTH)
|
||||
GENERIC_DEFERRED_CURSOR_MANAGER(deferred_push_cursor_manager_list_deferred_query_rdb_entry_releaseyear, DATABASE_QUERY_ENTRY_RELEASEDATE_YEAR)
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static int deferred_push_cursor_manager_list_deferred_query_subsearch(
|
||||
menu_displaylist_info_t *info)
|
||||
{
|
||||
int ret = -1;
|
||||
#ifdef HAVE_LIBRETRODB
|
||||
char query[PATH_MAX_LENGTH];
|
||||
struct string_list *str_list = string_split(info->path, "|");
|
||||
|
||||
query[0] = '\0';
|
||||
|
||||
database_info_build_query(query, sizeof(query),
|
||||
info->label, str_list->elems[0].data);
|
||||
|
||||
if (string_is_empty(query))
|
||||
goto end;
|
||||
|
||||
if (!string_is_empty(info->path))
|
||||
free(info->path);
|
||||
if (!string_is_empty(info->path_b))
|
||||
free(info->path_b);
|
||||
if (!string_is_empty(info->path_c))
|
||||
free(info->path_c);
|
||||
info->path = strdup(str_list->elems[1].data);
|
||||
info->path_b = strdup(str_list->elems[0].data);
|
||||
info->path_c = strdup(query);
|
||||
|
||||
ret = deferred_push_dlist(info, DISPLAYLIST_DATABASE_QUERY);
|
||||
|
||||
end:
|
||||
string_list_free(str_list);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int general_push(menu_displaylist_info_t *info,
|
||||
|
@ -4370,9 +4370,12 @@ static int action_ok_download_generic(const char *path,
|
||||
break;
|
||||
case MENU_ENUM_LABEL_CB_CORE_CONTENT_DOWNLOAD:
|
||||
{
|
||||
struct string_list *str_list = string_split(menu_label, ";");
|
||||
strlcpy(s, str_list->elems[0].data, sizeof(s));
|
||||
string_list_free(str_list);
|
||||
struct string_list str_list = {0};
|
||||
|
||||
string_list_initialize(&str_list);
|
||||
if (string_split_noalloc(&str_list, menu_label, ";"))
|
||||
strlcpy(s, str_list.elems[0].data, sizeof(s));
|
||||
string_list_deinitialize(&str_list);
|
||||
}
|
||||
break;
|
||||
case MENU_ENUM_LABEL_CB_LAKKA_DOWNLOAD:
|
||||
@ -4927,22 +4930,19 @@ static int action_ok_rdb_entry_submenu(const char *path,
|
||||
int ret = -1;
|
||||
char *rdb = NULL;
|
||||
int len = 0;
|
||||
struct string_list *str_list = NULL;
|
||||
struct string_list *str_list2 = NULL;
|
||||
struct string_list str_list = {0};
|
||||
struct string_list str_list2 = {0};
|
||||
|
||||
if (!label)
|
||||
return menu_cbs_exit();
|
||||
|
||||
new_label[0] = new_path[0] = '\0';
|
||||
|
||||
str_list = string_split(label, "|");
|
||||
|
||||
if (!str_list)
|
||||
string_list_initialize(&str_list);
|
||||
if (!string_split_noalloc(&str_list, label, "|"))
|
||||
goto end;
|
||||
|
||||
str_list2 = string_list_new();
|
||||
if (!str_list2)
|
||||
goto end;
|
||||
string_list_initialize(&str_list2);
|
||||
|
||||
/* element 0 : label
|
||||
* element 1 : value
|
||||
@ -4951,23 +4951,23 @@ static int action_ok_rdb_entry_submenu(const char *path,
|
||||
|
||||
attr.i = 0;
|
||||
|
||||
len += strlen(str_list->elems[1].data) + 1;
|
||||
string_list_append(str_list2, str_list->elems[1].data, attr);
|
||||
len += strlen(str_list.elems[1].data) + 1;
|
||||
string_list_append(&str_list2, str_list.elems[1].data, attr);
|
||||
|
||||
len += strlen(str_list->elems[2].data) + 1;
|
||||
string_list_append(str_list2, str_list->elems[2].data, attr);
|
||||
len += strlen(str_list.elems[2].data) + 1;
|
||||
string_list_append(&str_list2, str_list.elems[2].data, attr);
|
||||
|
||||
rdb = (char*)calloc(len, sizeof(char));
|
||||
|
||||
if (!rdb)
|
||||
goto end;
|
||||
|
||||
string_list_join_concat(rdb, len, str_list2, "|");
|
||||
string_list_join_concat(rdb, len, &str_list2, "|");
|
||||
strlcpy(new_path, rdb, sizeof(new_path));
|
||||
|
||||
fill_pathname_join_delim(new_label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST),
|
||||
str_list->elems[0].data, '_',
|
||||
str_list.elems[0].data, '_',
|
||||
sizeof(new_label));
|
||||
|
||||
ret = generic_action_ok_displaylist_push(new_path, NULL,
|
||||
@ -4977,10 +4977,8 @@ static int action_ok_rdb_entry_submenu(const char *path,
|
||||
end:
|
||||
if (rdb)
|
||||
free(rdb);
|
||||
if (str_list)
|
||||
string_list_free(str_list);
|
||||
if (str_list2)
|
||||
string_list_free(str_list2);
|
||||
string_list_deinitialize(&str_list);
|
||||
string_list_deinitialize(&str_list2);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1172,15 +1172,19 @@ static int action_bind_sublabel_netplay_room(
|
||||
{
|
||||
char buf[4096];
|
||||
unsigned i = 0;
|
||||
struct string_list *list = string_split(gamename, "|");
|
||||
struct string_list list = {0};
|
||||
|
||||
string_list_initialize(&list);
|
||||
string_split_noalloc(&list, gamename, "|");
|
||||
|
||||
buf[0] = '\0';
|
||||
for (i = 0; i < list->size; i++)
|
||||
|
||||
for (i = 0; i < list.size; i++)
|
||||
{
|
||||
strlcat(buf, " ", sizeof(buf));
|
||||
strlcat(buf, list->elems[i].data, sizeof(buf));
|
||||
strlcat(buf, list.elems[i].data, sizeof(buf));
|
||||
/* Never terminate a UI string with a newline */
|
||||
if (i != list->size - 1)
|
||||
if (i != list.size - 1)
|
||||
strlcat(buf, "\n", sizeof(buf));
|
||||
}
|
||||
snprintf(s, len,
|
||||
@ -1192,7 +1196,7 @@ static int action_bind_sublabel_netplay_room(
|
||||
corename, core_ver, subsystem,
|
||||
!string_is_equal(gamename, na) ? buf : na
|
||||
);
|
||||
string_list_free(list);
|
||||
string_list_deinitialize(&list);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -189,10 +189,13 @@ static int action_get_title_dropdown_item(
|
||||
if (string_starts_with_size(path, "core_option_", STRLEN_CONST("core_option_")))
|
||||
{
|
||||
/* This is a core options item */
|
||||
struct string_list *tmp_str_list = string_split(path, "_");
|
||||
struct string_list tmp_str_list = {0};
|
||||
int ret = 0;
|
||||
|
||||
if (tmp_str_list && tmp_str_list->size > 0)
|
||||
string_list_initialize(&tmp_str_list);
|
||||
string_split_noalloc(&tmp_str_list, path, "_");
|
||||
|
||||
if (tmp_str_list.size > 0)
|
||||
{
|
||||
core_option_manager_t *coreopts = NULL;
|
||||
|
||||
@ -201,7 +204,8 @@ static int action_get_title_dropdown_item(
|
||||
if (coreopts)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned menu_index = string_to_unsigned(tmp_str_list->elems[(unsigned)tmp_str_list->size - 1].data);
|
||||
unsigned menu_index = string_to_unsigned(
|
||||
tmp_str_list.elems[(unsigned)tmp_str_list.size - 1].data);
|
||||
unsigned visible_index = 0;
|
||||
unsigned option_index = 0;
|
||||
bool option_found = false;
|
||||
@ -242,8 +246,7 @@ static int action_get_title_dropdown_item(
|
||||
}
|
||||
|
||||
/* Clean up */
|
||||
if (tmp_str_list)
|
||||
string_list_free(tmp_str_list);
|
||||
string_list_deinitialize(&tmp_str_list);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -795,20 +798,20 @@ static int action_get_title_group_settings(const char *path, const char *label,
|
||||
{
|
||||
char elem0[255];
|
||||
char elem1[255];
|
||||
struct string_list *list_label = string_split(label, "|");
|
||||
|
||||
struct string_list list_label = {0};
|
||||
|
||||
elem0[0] = elem1[0] = '\0';
|
||||
|
||||
if (list_label)
|
||||
string_list_initialize(&list_label);
|
||||
string_split_noalloc(&list_label, label, "|");
|
||||
|
||||
if (list_label.size > 0)
|
||||
{
|
||||
if (list_label->size > 0)
|
||||
{
|
||||
strlcpy(elem0, list_label->elems[0].data, sizeof(elem0));
|
||||
if (list_label->size > 1)
|
||||
strlcpy(elem1, list_label->elems[1].data, sizeof(elem1));
|
||||
}
|
||||
string_list_free(list_label);
|
||||
strlcpy(elem0, list_label.elems[0].data, sizeof(elem0));
|
||||
if (list_label.size > 1)
|
||||
strlcpy(elem1, list_label.elems[1].data, sizeof(elem1));
|
||||
}
|
||||
string_list_deinitialize(&list_label);
|
||||
|
||||
strlcpy(s, elem0, len);
|
||||
|
||||
@ -822,7 +825,8 @@ static int action_get_title_group_settings(const char *path, const char *label,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_get_title_input_binds_list(const char *path, const char *label,
|
||||
static int action_get_title_input_binds_list(
|
||||
const char *path, const char *label,
|
||||
unsigned menu_type, char *s, size_t len)
|
||||
{
|
||||
unsigned val = (((unsigned)path[0]) - 49) + 1;
|
||||
|
@ -1764,45 +1764,46 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
|
||||
for (j = 0; j < playlist_size(playlist); j++)
|
||||
{
|
||||
const struct playlist_entry *entry = NULL;
|
||||
bool match_found = false;
|
||||
struct string_list *tmp_str_list = NULL;
|
||||
bool match_found = false;
|
||||
|
||||
playlist_get_index(playlist, j, &entry);
|
||||
|
||||
if (entry->crc32)
|
||||
tmp_str_list = string_split(entry->crc32, "|");
|
||||
|
||||
if (!tmp_str_list)
|
||||
continue;
|
||||
|
||||
if (tmp_str_list->size > 0)
|
||||
{
|
||||
if (tmp_str_list->size > 1)
|
||||
{
|
||||
const char *elem0 = tmp_str_list->elems[0].data;
|
||||
const char *elem1 = tmp_str_list->elems[1].data;
|
||||
struct string_list tmp_str_list = {0};
|
||||
|
||||
switch (extension_to_file_hash_type(elem1))
|
||||
string_list_initialize(&tmp_str_list);
|
||||
string_split_noalloc(&tmp_str_list, entry->crc32, "|");
|
||||
|
||||
if (tmp_str_list.size > 0)
|
||||
{
|
||||
if (tmp_str_list.size > 1)
|
||||
{
|
||||
case FILE_TYPE_CRC:
|
||||
if (string_is_equal(crc_str, elem0))
|
||||
match_found = true;
|
||||
break;
|
||||
case FILE_TYPE_SHA1:
|
||||
if (string_is_equal(db_info_entry->sha1, elem0))
|
||||
match_found = true;
|
||||
break;
|
||||
case FILE_TYPE_MD5:
|
||||
if (string_is_equal(db_info_entry->md5, elem0))
|
||||
match_found = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
const char *elem0 = tmp_str_list.elems[0].data;
|
||||
const char *elem1 = tmp_str_list.elems[1].data;
|
||||
|
||||
switch (extension_to_file_hash_type(elem1))
|
||||
{
|
||||
case FILE_TYPE_CRC:
|
||||
if (string_is_equal(crc_str, elem0))
|
||||
match_found = true;
|
||||
break;
|
||||
case FILE_TYPE_SHA1:
|
||||
if (string_is_equal(db_info_entry->sha1, elem0))
|
||||
match_found = true;
|
||||
break;
|
||||
case FILE_TYPE_MD5:
|
||||
if (string_is_equal(db_info_entry->md5, elem0))
|
||||
match_found = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string_list_free(tmp_str_list);
|
||||
string_list_deinitialize(&tmp_str_list);
|
||||
}
|
||||
|
||||
if (!match_found)
|
||||
continue;
|
||||
@ -9904,14 +9905,17 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
{
|
||||
#ifdef HAVE_NETWORKING
|
||||
char new_label[PATH_MAX_LENGTH];
|
||||
struct string_list *str_list = string_split(info->path, ";");
|
||||
|
||||
struct string_list str_list = {0};
|
||||
|
||||
new_label[0] = '\0';
|
||||
|
||||
if (str_list->elems[0].data)
|
||||
strlcpy(new_label, str_list->elems[0].data, sizeof(new_label));
|
||||
if (str_list->elems[1].data)
|
||||
strlcpy(menu->core_buf, str_list->elems[1].data, menu->core_len);
|
||||
string_list_initialize(&str_list);
|
||||
string_split_noalloc(&str_list, info->path, ";");
|
||||
|
||||
if (str_list.elems[0].data)
|
||||
strlcpy(new_label, str_list.elems[0].data, sizeof(new_label));
|
||||
if (str_list.elems[1].data)
|
||||
strlcpy(menu->core_buf, str_list.elems[1].data, menu->core_len);
|
||||
|
||||
count = print_buf_lines(info->list, menu->core_buf, new_label,
|
||||
(int)menu->core_len, FILE_TYPE_DOWNLOAD_URL, false, false);
|
||||
@ -9927,7 +9931,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
info->need_refresh = true;
|
||||
info->need_clear = true;
|
||||
|
||||
string_list_free(str_list);
|
||||
string_list_deinitialize(&str_list);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
@ -11865,9 +11869,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
if (string_starts_with_size(info->path, "core_option_",
|
||||
STRLEN_CONST("core_option_")))
|
||||
{
|
||||
struct string_list *tmp_str_list = string_split(info->path, "_");
|
||||
struct string_list tmp_str_list = {0};
|
||||
string_list_initialize(&tmp_str_list);
|
||||
string_split_noalloc(&tmp_str_list, info->path, "_");
|
||||
|
||||
if (tmp_str_list && tmp_str_list->size > 0)
|
||||
if (tmp_str_list.size > 0)
|
||||
{
|
||||
core_option_manager_t *coreopts = NULL;
|
||||
const char *val = NULL;
|
||||
@ -11877,8 +11883,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
if (coreopts)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned size = (unsigned)tmp_str_list->size;
|
||||
unsigned menu_index = atoi(tmp_str_list->elems[size-1].data);
|
||||
unsigned size = (unsigned)
|
||||
tmp_str_list.size;
|
||||
unsigned menu_index = atoi(tmp_str_list.elems[size-1].data);
|
||||
unsigned visible_index = 0;
|
||||
unsigned option_index = 0;
|
||||
bool option_found = false;
|
||||
@ -11958,8 +11965,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
}
|
||||
}
|
||||
|
||||
if (tmp_str_list)
|
||||
string_list_free(tmp_str_list);
|
||||
string_list_deinitialize(&tmp_str_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -11972,12 +11978,16 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
{
|
||||
case ST_STRING_OPTIONS:
|
||||
{
|
||||
struct string_list *tmp_str_list = string_split(setting->values, "|");
|
||||
struct string_list tmp_str_list = {0};
|
||||
string_list_initialize(&tmp_str_list);
|
||||
string_split_noalloc(&tmp_str_list,
|
||||
setting->values, "|");
|
||||
|
||||
if (tmp_str_list && tmp_str_list->size > 0)
|
||||
if (tmp_str_list.size > 0)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned size = (unsigned)tmp_str_list->size;
|
||||
unsigned size = (unsigned)
|
||||
tmp_str_list.size;
|
||||
bool checked_found = false;
|
||||
unsigned checked = 0;
|
||||
|
||||
@ -11986,13 +11996,15 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
char val_d[256];
|
||||
snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx);
|
||||
if (menu_entries_append_enum(info->list,
|
||||
tmp_str_list->elems[i].data,
|
||||
tmp_str_list.elems[i].data,
|
||||
val_d,
|
||||
MENU_ENUM_LABEL_NO_ITEMS,
|
||||
MENU_SETTING_DROPDOWN_SETTING_STRING_OPTIONS_ITEM, i, 0))
|
||||
count++;
|
||||
|
||||
if (!checked_found && string_is_equal(tmp_str_list->elems[i].data, setting->value.target.string))
|
||||
if (!checked_found && string_is_equal(
|
||||
tmp_str_list.elems[i].data,
|
||||
setting->value.target.string))
|
||||
{
|
||||
checked = i;
|
||||
checked_found = true;
|
||||
@ -12006,8 +12018,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
}
|
||||
}
|
||||
|
||||
if (tmp_str_list)
|
||||
string_list_free(tmp_str_list);
|
||||
string_list_deinitialize(&tmp_str_list);
|
||||
}
|
||||
break;
|
||||
case ST_INT:
|
||||
@ -12285,9 +12296,12 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
if (string_starts_with_size(info->path, "core_option_",
|
||||
STRLEN_CONST("core_option_")))
|
||||
{
|
||||
struct string_list *tmp_str_list = string_split(info->path, "_");
|
||||
struct string_list tmp_str_list = {0};
|
||||
|
||||
if (tmp_str_list && tmp_str_list->size > 0)
|
||||
string_list_initialize(&tmp_str_list);
|
||||
string_split_noalloc(&tmp_str_list, info->path, "_");
|
||||
|
||||
if (tmp_str_list.size > 0)
|
||||
{
|
||||
core_option_manager_t *coreopts = NULL;
|
||||
const char *val = NULL;
|
||||
@ -12296,8 +12310,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
|
||||
if (coreopts)
|
||||
{
|
||||
unsigned size = (unsigned)tmp_str_list->size;
|
||||
unsigned menu_index = atoi(tmp_str_list->elems[size-1].data);
|
||||
unsigned size = (unsigned)
|
||||
tmp_str_list.size;
|
||||
unsigned menu_index = atoi(tmp_str_list.elems[size-1].data);
|
||||
unsigned visible_index = 0;
|
||||
unsigned option_index = 0;
|
||||
bool option_found = false;
|
||||
@ -12375,8 +12390,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
}
|
||||
}
|
||||
|
||||
if (tmp_str_list)
|
||||
string_list_free(tmp_str_list);
|
||||
string_list_deinitialize(&tmp_str_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -12389,12 +12403,16 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
{
|
||||
case ST_STRING_OPTIONS:
|
||||
{
|
||||
struct string_list *tmp_str_list = string_split(setting->values, "|");
|
||||
struct string_list tmp_str_list = {0};
|
||||
|
||||
string_list_initialize(&tmp_str_list);
|
||||
string_split_noalloc(&tmp_str_list,
|
||||
setting->values, "|");
|
||||
|
||||
if (tmp_str_list && tmp_str_list->size > 0)
|
||||
if (tmp_str_list.size > 0)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned size = (unsigned)tmp_str_list->size;
|
||||
unsigned size = (unsigned)tmp_str_list.size;
|
||||
bool checked_found = false;
|
||||
unsigned checked = 0;
|
||||
|
||||
@ -12403,13 +12421,15 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
char val_d[256];
|
||||
snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx);
|
||||
if (menu_entries_append_enum(info->list,
|
||||
tmp_str_list->elems[i].data,
|
||||
tmp_str_list.elems[i].data,
|
||||
val_d,
|
||||
MENU_ENUM_LABEL_NO_ITEMS,
|
||||
MENU_SETTING_DROPDOWN_SETTING_STRING_OPTIONS_ITEM_SPECIAL, i, 0))
|
||||
count++;
|
||||
|
||||
if (!checked_found && string_is_equal(tmp_str_list->elems[i].data, setting->value.target.string))
|
||||
if (!checked_found &&
|
||||
string_is_equal(tmp_str_list.elems[i].data,
|
||||
setting->value.target.string))
|
||||
{
|
||||
checked = i;
|
||||
checked_found = true;
|
||||
@ -12423,8 +12443,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
}
|
||||
}
|
||||
|
||||
if (tmp_str_list)
|
||||
string_list_free(tmp_str_list);
|
||||
string_list_deinitialize(&tmp_str_list);
|
||||
}
|
||||
break;
|
||||
case ST_INT:
|
||||
|
Loading…
x
Reference in New Issue
Block a user