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(
|
bool content_file_override_set(
|
||||||
const struct retro_system_content_info_override *overrides)
|
const struct retro_system_content_info_override *overrides)
|
||||||
{
|
{
|
||||||
content_state_t *p_content = content_state_get_ptr();
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
content_state_t *p_content = content_state_get_ptr();
|
||||||
|
|
||||||
if (!p_content || !overrides)
|
if (!p_content || !overrides)
|
||||||
return false;
|
return false;
|
||||||
@ -222,28 +222,20 @@ bool content_file_override_set(
|
|||||||
|
|
||||||
for (i = 0; overrides[i].extensions; i++)
|
for (i = 0; overrides[i].extensions; i++)
|
||||||
{
|
{
|
||||||
struct string_list ext_list = {0};
|
char *tok, *save;
|
||||||
size_t j;
|
char *overrides_ext_cpy = strdup(overrides[i].extensions);
|
||||||
|
|
||||||
/* Get list of extensions affected by override */
|
for (tok = strtok_r(overrides_ext_cpy, "|", &save); tok;
|
||||||
string_list_initialize(&ext_list);
|
tok = strtok_r(NULL, "|", &save))
|
||||||
if (!string_split_noalloc(&ext_list,
|
|
||||||
overrides[i].extensions, "|"))
|
|
||||||
{
|
{
|
||||||
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;
|
size_t num_entries;
|
||||||
|
const char *ext = tok;
|
||||||
|
content_file_override_t *override = NULL;
|
||||||
|
|
||||||
/* Check whether extension has already been
|
/* Check whether extension has already been
|
||||||
* registered */
|
* registered */
|
||||||
if (string_is_empty(ext) ||
|
if ( string_is_empty(ext)
|
||||||
content_file_override_get_ext(p_content, ext, NULL))
|
|| content_file_override_get_ext(p_content, ext, NULL))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Add current override to the list */
|
/* Add current override to the list */
|
||||||
@ -252,7 +244,7 @@ bool content_file_override_set(
|
|||||||
if (!RBUF_TRYFIT(p_content->content_override_list,
|
if (!RBUF_TRYFIT(p_content->content_override_list,
|
||||||
num_entries + 1))
|
num_entries + 1))
|
||||||
{
|
{
|
||||||
string_list_deinitialize(&ext_list);
|
free(overrides_ext_cpy);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +261,7 @@ bool content_file_override_set(
|
|||||||
override->persistent_data = overrides[i].persistent_data;
|
override->persistent_data = overrides[i].persistent_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
string_list_deinitialize(&ext_list);
|
free(overrides_ext_cpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user