(menu/cbs) Avoid implicit memsets in performance-crucial areas

This commit is contained in:
twinaphex 2016-10-08 18:23:10 +02:00
parent f923c7ecd7
commit 81a7f7bf68
3 changed files with 16 additions and 6 deletions

View File

@ -1365,7 +1365,7 @@ static void menu_action_setting_disp_set_label_playlist_associations(file_list_t
const char *path,
char *s2, size_t len2)
{
char playlist_name_with_ext[PATH_MAX_LENGTH] = {0};
char playlist_name_with_ext[PATH_MAX_LENGTH];
bool found_matching_core_association = false;
settings_t *settings = config_get_ptr();
struct string_list *str_list = string_split(settings->playlist_names, ";");
@ -1373,6 +1373,7 @@ static void menu_action_setting_disp_set_label_playlist_associations(file_list_t
strlcpy(s2, path, len2);
playlist_name_with_ext[0] = '\0';
*s = '\0';
*w = 19;

View File

@ -84,7 +84,9 @@ static int action_bind_label_playlist_collection_entry(
{
if (strstr(path, file_path_str(FILE_PATH_LPL_EXTENSION)))
{
char path_base[PATH_MAX_LENGTH] = {0};
char path_base[PATH_MAX_LENGTH];
path_base[0] = '\0';
fill_short_pathname_representation_noext(path_base, path,
sizeof(path_base));

View File

@ -37,7 +37,9 @@ static void replace_chars(char *str, char c1, char c2)
static void sanitize_to_string(char *s, const char *label, size_t len)
{
char new_label[PATH_MAX_LENGTH] = {0};
char new_label[PATH_MAX_LENGTH];
new_label[0] = '\0';
strlcpy(new_label, label, sizeof(new_label));
strlcpy(s, new_label, len);
@ -694,7 +696,10 @@ static int action_get_title_generic(char *s, size_t len, const char *path,
if (list_path)
{
char elem0_path[PATH_MAX_LENGTH] = {0};
char elem0_path[PATH_MAX_LENGTH];
elem0_path[0] = '\0';
if (list_path->size > 0)
strlcpy(elem0_path, list_path->elems[0].data, sizeof(elem0_path));
string_list_free(list_path);
@ -840,10 +845,12 @@ static int action_get_title_group_settings(const char *path, const char *label,
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_HORIZONTAL_MENU), len);
else
{
char elem0[PATH_MAX_LENGTH] = {0};
char elem1[PATH_MAX_LENGTH] = {0};
char elem0[PATH_MAX_LENGTH];
char elem1[PATH_MAX_LENGTH];
struct string_list *list_label = string_split(label, "|");
elem0[0] = elem1[0] = '\0';
if (list_label)
{
if (list_label->size > 0)