From ec4c15e8e490813f26eef106e0404ff696553fb7 Mon Sep 17 00:00:00 2001 From: LibretroAdmin Date: Thu, 4 Aug 2022 00:00:21 +0200 Subject: [PATCH] (gfx_widget_load_content_animation) Cleanups - one strlen instead of two, NULL termination of some strings is not necessary since it gets passed to strlcpy and/or fill_pathname_join anyway --- gfx/widgets/gfx_widget_load_content_animation.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/gfx/widgets/gfx_widget_load_content_animation.c b/gfx/widgets/gfx_widget_load_content_animation.c index 37f94d8532..2046ded377 100644 --- a/gfx/widgets/gfx_widget_load_content_animation.c +++ b/gfx/widgets/gfx_widget_load_content_animation.c @@ -393,15 +393,17 @@ bool gfx_widget_start_load_content_animation(void) if (!string_is_empty(playlist_path)) { + size_t system_name_len; fill_pathname_base(state->system_name, playlist_path, sizeof(state->system_name)); path_remove_extension(state->system_name); + system_name_len = strlen(state->system_name); /* Exclude history and favourites playlists */ if (string_ends_with_size(state->system_name, "_history", - strlen(state->system_name), STRLEN_CONST("_history")) || + system_name_len, STRLEN_CONST("_history")) || string_ends_with_size(state->system_name, "_favorites", - strlen(state->system_name), STRLEN_CONST("_favorites"))) + system_name_len, STRLEN_CONST("_favorites"))) state->system_name[0] = '\0'; /* Check whether a valid system name was found */ @@ -474,9 +476,6 @@ bool gfx_widget_start_load_content_animation(void) if (!string_is_empty(core_db_name) && !string_is_equal(core_db_name, state->system_name)) { - state->icon_file[0] = '\0'; - icon_path[0] = '\0'; - strlcpy(state->icon_file, core_db_name, sizeof(state->icon_file)); strlcat(state->icon_file, ".png", @@ -494,11 +493,7 @@ bool gfx_widget_start_load_content_animation(void) * use default 'retroarch' icon as a fallback */ if (!state->has_icon) { - state->icon_file[0] = '\0'; - icon_path[0] = '\0'; - - strcpy_literal(state->icon_file, "retroarch.png"); - + strlcpy(state->icon_file, "retroarch.png", sizeof(state->icon_file)); fill_pathname_join(icon_path, state->icon_directory, state->icon_file, sizeof(icon_path));