Replace strstrs where possible

This commit is contained in:
twinaphex 2020-05-22 21:11:35 +02:00
parent 31674f9246
commit eaba575c9e
4 changed files with 8 additions and 6 deletions

View File

@ -895,7 +895,7 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
* treatment, since the label has the format:
* <MENU_ENUM_LABEL_DEFERRED_RDB_ENTRY_DETAIL>|<entry_name>
* i.e. cannot use a normal string_is_equal() */
if (strstr(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RDB_ENTRY_DETAIL)))
if (string_starts_with(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RDB_ENTRY_DETAIL)))
{
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_rdb_entry_detail);
}

View File

@ -10570,7 +10570,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
{
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
if (strstr(info->path, "core_option_"))
if (string_starts_with(info->path, "core_option_"))
{
struct string_list *tmp_str_list = string_split(info->path, "_");
@ -10988,7 +10988,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
case DISPLAYLIST_DROPDOWN_LIST_SPECIAL:
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
if (strstr(info->path, "core_option_"))
if (string_starts_with(info->path, "core_option_"))
{
struct string_list *tmp_str_list = string_split(info->path, "_");

View File

@ -152,7 +152,8 @@ void cb_net_generic_subdir(retro_task_t *task,
subdir_path[data->len] = '\0';
finish:
if (!err && !strstr(subdir_path, file_path_str(FILE_PATH_INDEX_DIRS_URL)))
if (!err && !string_ends_with(subdir_path,
file_path_str(FILE_PATH_INDEX_DIRS_URL)))
{
char parent_dir[PATH_MAX_LENGTH];
@ -219,7 +220,8 @@ finish:
free(data);
}
if (!err && !strstr(state->path, file_path_str(FILE_PATH_INDEX_DIRS_URL)))
if (!err &&
!string_ends_with(state->path, file_path_str(FILE_PATH_INDEX_DIRS_URL)))
{
char *parent_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
char *parent_dir_encoded = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));

View File

@ -353,7 +353,7 @@ void* task_push_http_transfer_file(const char* url, bool mute,
strlcpy(tmp, msg_hash_to_str(MSG_DOWNLOADING), sizeof(tmp));
strlcat(tmp, " ", sizeof(tmp));
if (strstr(s, ".index"))
if (string_ends_with(s, ".index"))
strlcat(tmp, msg_hash_to_str(MSG_INDEX_FILE), sizeof(tmp));
else
strlcat(tmp, s, sizeof(tmp));