mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 07:59:42 +00:00
(task_content.c) content_file_override_set - use strtok_r instead
of string_list
This commit is contained in:
parent
36e9d4a79d
commit
4eb8b772ec
@ -211,8 +211,8 @@ static bool content_file_override_get_ext(
|
||||
bool content_file_override_set(
|
||||
const struct retro_system_content_info_override *overrides)
|
||||
{
|
||||
content_state_t *p_content = content_state_get_ptr();
|
||||
size_t i;
|
||||
content_state_t *p_content = content_state_get_ptr();
|
||||
|
||||
if (!p_content || !overrides)
|
||||
return false;
|
||||
@ -222,28 +222,20 @@ bool content_file_override_set(
|
||||
|
||||
for (i = 0; overrides[i].extensions; i++)
|
||||
{
|
||||
struct string_list ext_list = {0};
|
||||
size_t j;
|
||||
char *tok, *save;
|
||||
char *overrides_ext_cpy = strdup(overrides[i].extensions);
|
||||
|
||||
/* Get list of extensions affected by override */
|
||||
string_list_initialize(&ext_list);
|
||||
if (!string_split_noalloc(&ext_list,
|
||||
overrides[i].extensions, "|"))
|
||||
for (tok = strtok_r(overrides_ext_cpy, "|", &save); tok;
|
||||
tok = strtok_r(NULL, "|", &save))
|
||||
{
|
||||
string_list_deinitialize(&ext_list);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (j = 0; j < ext_list.size; j++)
|
||||
{
|
||||
const char *ext = ext_list.elems[j].data;
|
||||
content_file_override_t *override = NULL;
|
||||
size_t num_entries;
|
||||
const char *ext = tok;
|
||||
content_file_override_t *override = NULL;
|
||||
|
||||
/* Check whether extension has already been
|
||||
* registered */
|
||||
if (string_is_empty(ext) ||
|
||||
content_file_override_get_ext(p_content, ext, NULL))
|
||||
if ( string_is_empty(ext)
|
||||
|| content_file_override_get_ext(p_content, ext, NULL))
|
||||
continue;
|
||||
|
||||
/* Add current override to the list */
|
||||
@ -252,7 +244,7 @@ bool content_file_override_set(
|
||||
if (!RBUF_TRYFIT(p_content->content_override_list,
|
||||
num_entries + 1))
|
||||
{
|
||||
string_list_deinitialize(&ext_list);
|
||||
free(overrides_ext_cpy);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -269,7 +261,7 @@ bool content_file_override_set(
|
||||
override->persistent_data = overrides[i].persistent_data;
|
||||
}
|
||||
|
||||
string_list_deinitialize(&ext_list);
|
||||
free(overrides_ext_cpy);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user