From 2f1e6ad402ed0402f5b13ff847df81da98bfb205 Mon Sep 17 00:00:00 2001 From: NightlyFox Date: Fri, 21 Sep 2018 21:06:10 -0500 Subject: [PATCH] got rid of void* cast when freeing, got rid of comments asking questions, got rid of superflous cast --- common/menu.h | 2 +- common/theme.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/menu.h b/common/menu.h index 6cd0dfe..a7f690d 100644 --- a/common/menu.h +++ b/common/menu.h @@ -119,7 +119,7 @@ static inline char* removeExtension(const char* str){ *copy = *p; copy++; } - return (char*)copyHead; + return copyHead; } static inline void replaceCharacter(char* str, char orig, char repl){ diff --git a/common/theme.c b/common/theme.c index 54bc1df..bd4159b 100644 --- a/common/theme.c +++ b/common/theme.c @@ -15,8 +15,8 @@ bool colorFromSetting(config_setting_t *rgba, color_t *col) { void themeStartup(ThemePreset preset) { globalPreset = preset; - char* buttonAText = calloc(7,sizeof(char));/*Must initialize the character arrays on the heap*/ - char* buttonBText = calloc(7,sizeof(char));/*so that they are not destroyed whenever themeStartup function ends*/ + char* buttonAText = calloc(7,sizeof(char)); + char* buttonBText = calloc(7,sizeof(char)); switch (preset) { case THEME_PRESET_LIGHT: default: @@ -39,8 +39,8 @@ void themeStartup(ThemePreset preset) { .borderColor = MakeColor(255,255,255,255), .borderTextColor = MakeColor(64,64,64,255), .enableWaveBlending = 0, - .buttonAText = buttonAText,/*setting the buttonAText = "\uE0E0" directly allocates the literal on the stack */ - .buttonBText = buttonBText,/*and sets the buttonAText to point to the address of the literal which is why calloc is used above*/ + .buttonAText = buttonAText, + .buttonBText = buttonBText, //.buttonAImage = button_a_light_bin, //.buttonBImage = button_b_light_bin, .hbmenuLogoImage = hbmenu_logo_light_bin @@ -67,10 +67,10 @@ void themeStartup(ThemePreset preset) { char tmp_path[PATH_MAX] = {0}; #ifdef __SWITCH__ - tmp_path[0] = '/';/*will this work on the windows version?*/ + tmp_path[0] = '/'; #endif - strncat(tmp_path, "config/nx-hbmenu/themes/theme.cfg", sizeof(tmp_path)-2);/*Same thing here? will it work on windows?*/ + strncat(tmp_path, "config/nx-hbmenu/themes/theme.cfg", sizeof(tmp_path)-2); theme_t *themeDefault; config_t cfg = {0};