Ticket #1755: code cleanup before 4.7.0-pre4 release.

Free some variables allocated at MC startup.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2009-10-29 22:04:44 +03:00 committed by Slava Zanko
parent 7ce5e1eacb
commit 91a4598b54
5 changed files with 37 additions and 9 deletions

View File

@ -2236,6 +2236,8 @@ main (int argc, char *argv[])
/* Save the tree store */
tree_store_save ();
free_keymap_defs ();
/* Virtual File System shutdown */
vfs_shut ();

View File

@ -78,7 +78,6 @@ extern int num_history_items_recorded;
char *profile_name; /* .mc/ini */
char *global_profile_name; /* mc.lib */
char *panels_profile_name; /* .mc/panels.ini */
char *setup_color_string;
char *term_color_string;
@ -92,6 +91,8 @@ int startup_right_mode;
int saving_setup;
int setup_copymove_persistent_attr = 1;
static char *panels_profile_name = NULL; /* .mc/panels.ini */
static const struct {
const char *key;
int list_type;
@ -834,15 +835,23 @@ load_anon_passwd ()
}
#endif /* USE_VFS && USE_NETCODE */
void done_setup (void)
void
done_setup (void)
{
int i;
g_free (profile_name);
g_free (global_profile_name);
g_free(color_terminal_string);
g_free(term_color_string);
g_free(setup_color_string);
mc_config_deinit(mc_main_config);
mc_config_deinit(mc_panels_config);
g_free (color_terminal_string);
g_free (term_color_string);
g_free (setup_color_string);
g_free (panels_profile_name);
mc_config_deinit (mc_main_config);
mc_config_deinit (mc_panels_config);
for (i = 0; str_options[i].opt_name != NULL; i++)
g_free (*str_options[i].opt_addr);
done_hotlist ();
done_panelize ();
/* directory_history_free (); */
@ -1001,6 +1010,21 @@ load_keymap_defs (void)
}
}
void
free_keymap_defs (void)
{
#ifdef USE_INTERNAL_EDIT
g_array_free (editor_keymap, TRUE);
g_array_free (editor_x_keymap, TRUE);
#endif
g_array_free (viewer_keymap, TRUE);
g_array_free (viewer_hex_keymap, TRUE);
g_array_free (main_keymap, TRUE);
g_array_free (main_x_keymap, TRUE);
g_array_free (panel_keymap, TRUE);
g_array_free (input_keymap, TRUE);
}
void
setup_save_config_show_error(const char *filename, GError **error)
{

View File

@ -21,6 +21,7 @@ void panel_save_setup (struct WPanel *panel, const char *section);
void panel_load_setup (struct WPanel *panel, const char *section);
void save_panel_types (void);
void load_keymap_defs (void);
void free_keymap_defs (void);
extern char *profile_name;
extern char *global_profile_name;

View File

@ -61,7 +61,7 @@ static const char *str_8bit_encodings[] = {
};
/* terminal encoding*/
static char *codeset;
static char *codeset = NULL;
/* function for encoding specific operations*/
static struct str_class used_class;
@ -405,6 +405,7 @@ void
str_uninit_strings ()
{
g_iconv_close (str_cnv_not_convert);
g_free (codeset);
}
const char *

View File

@ -1300,8 +1300,8 @@ vfs_shut (void)
(*vfs->done) (vfs);
g_ptr_array_free (vfs_openfiles, TRUE);
g_string_free (vfs_str_buffer, TRUE);
g_free (mc_readdir_result);
}
/*