Optimize some strlen and file_path_str usage - condense this

back to STRLEN_CONST usage
This commit is contained in:
twinaphex 2020-06-28 00:36:23 +02:00
parent c1c3f75804
commit 6e015d32a8

View file

@ -153,9 +153,9 @@ void cb_net_generic_subdir(retro_task_t *task,
finish:
if (!err && !string_ends_with_size(subdir_path,
file_path_str(FILE_PATH_INDEX_DIRS_URL),
".index-dirs",
strlen(subdir_path),
strlen(file_path_str(FILE_PATH_INDEX_DIRS_URL))
STRLEN_CONST(".index-dirs")
))
{
char parent_dir[PATH_MAX_LENGTH];
@ -225,9 +225,9 @@ finish:
if (!err &&
!string_ends_with_size(state->path,
file_path_str(FILE_PATH_INDEX_DIRS_URL),
".index-dirs",
strlen(state->path),
strlen(file_path_str(FILE_PATH_INDEX_DIRS_URL))
STRLEN_CONST(".index-dirs")
))
{
char *parent_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
@ -238,9 +238,10 @@ finish:
parent_dir_encoded[0] = '\0';
fill_pathname_parent_dir(parent_dir,
state->path, PATH_MAX_LENGTH * sizeof(char));
state->path,
PATH_MAX_LENGTH * sizeof(char));
strlcat(parent_dir,
file_path_str(FILE_PATH_INDEX_DIRS_URL),
".index-dirs",
PATH_MAX_LENGTH * sizeof(char));
transf = (file_transfer_t*)malloc(sizeof(*transf));