From 48c98b22342ef9576f848fbbae5922303be8bc27 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 28 Jun 2009 19:36:06 +0000 Subject: [PATCH] -Remove the spaces I just added when looking for the fonts, -No need to check if a pointer is NULL before freeing it, free() takes care of that, -Removed useless variables after Yves cleanup git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@889 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- buttons.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/buttons.c b/buttons.c index 9004e6a3..c447dab5 100644 --- a/buttons.c +++ b/buttons.c @@ -1018,13 +1018,7 @@ void Button_Skins(void) { short clicked_button; short temp; - char quicksearch_filename[MAX_PATH_CHARACTERS]=""; - char * most_matching_filename; char skinsdir[MAX_PATH_CHARACTERS]; - DIR* current_directory; //Répertoire courant - struct dirent* entry; // Structure de lecture des éléments - struct stat Infos_enreg; - char * current_path; static int selector_position=0; T_Config Config_choisie = Config; T_Dropdown_button * font_dropdown; @@ -1248,6 +1242,8 @@ void Button_Skins(void) if(clicked_button == 1) { + char* tmp_font; + char* tmp_ptr; T_Gui_skin * gfx; strcpy(skinsdir,"skins/"); strcat( @@ -1265,16 +1261,18 @@ void Button_Skins(void) free(Gfx); Gfx = gfx; // Font selection - new_font = Load_font(fonts[selected_font]); + tmp_font = strdup(fonts[selected_font]); + tmp_ptr=tmp_font; + while(*tmp_ptr!=' ' && *tmp_ptr!='\0') + tmp_ptr++; + *tmp_ptr='\0'; + new_font = Load_font(tmp_font); + free(tmp_font); if (new_font) { free(Menu_font); Menu_font = new_font; - if (Config_choisie.Font_name) - { - free (Config_choisie.Font_name); - Config_choisie.Font_name = NULL; - } + free (Config_choisie.Font_name); Config_choisie.Font_name = (char *)malloc(strlen(fonts[selected_font])+1); if (Config_choisie.Font_name) {