1
1

* boxes.c (configure_vfs): g_free handles NULL argument too,

no need for the comparison.
        * cmd.c (set_panel_filter_to): Likewise.
            (do_link): Likewise.
            (quick_cd_cmd): Likewise.
        * color.c (done_colors): Likewise.
        * dialog.c (destroy_dlg): Likewise.
        * dir.c (alloc_dir_copy): Likewise.
        * ext.c (flush_extension_file): Likewise.
        * file.c (copy_file_file): Likewise.
            (panel_operate): Likewise.
        * hotlist.c (remove_group): Likewise.
            (remove_from_hotlist): Likewise.
            (done_hotlist): Likewise.
        * main.c (main): Likewise.
        * setup.c (panel_load_setup): Likewise.
        * tree.c (tree_destroy): Likewise.
            (show_tree): Likewise.
        * user.c (user_menu_cmd): Likewise.
        * utilunix.c (i_cache_add): Likewise.
            (putenv): Likewise.
        * view.c (view_done): Likewise.
            (regexp_search): Likewise.
            (normal_search): Likewise.
            (change_viewer): Likewise.
        * widget.c (label_set_text): Likewise.
            (set_label_text): Likewise.
Этот коммит содержится в:
Andrew V. Samoilov 2004-09-24 22:22:35 +00:00
родитель 2448006e86
Коммит 68a7c1dfab
16 изменённых файлов: 77 добавлений и 92 удалений

Просмотреть файл

@ -1,3 +1,33 @@
2004-09-25 Pavel Shirshov <pavelsh@mail.ru>
* boxes.c (configure_vfs): g_free handles NULL argument too,
no need for the comparison.
* cmd.c (set_panel_filter_to): Likewise.
(do_link): Likewise.
(quick_cd_cmd): Likewise.
* color.c (done_colors): Likewise.
* dialog.c (destroy_dlg): Likewise.
* dir.c (alloc_dir_copy): Likewise.
* ext.c (flush_extension_file): Likewise.
* file.c (copy_file_file): Likewise.
(panel_operate): Likewise.
* hotlist.c (remove_group): Likewise.
(remove_from_hotlist): Likewise.
(done_hotlist): Likewise.
* main.c (main): Likewise.
* setup.c (panel_load_setup): Likewise.
* tree.c (tree_destroy): Likewise.
(show_tree): Likewise.
* user.c (user_menu_cmd): Likewise.
* utilunix.c (i_cache_add): Likewise.
(putenv): Likewise.
* view.c (view_done): Likewise.
(regexp_search): Likewise.
(normal_search): Likewise.
(change_viewer): Likewise.
* widget.c (label_set_text): Likewise.
(set_label_text): Likewise.
2004-09-24 Roland Illig <roland.illig@gmx.de>
* file.c (progress_update_one): Changed parameter type from int

Просмотреть файл

@ -771,8 +771,7 @@ configure_vfs (void)
#if defined(USE_NETCODE)
g_free (ftpfs_anonymous_passwd);
ftpfs_anonymous_passwd = ret_passwd;
if (ftpfs_proxy_host)
g_free (ftpfs_proxy_host);
g_free (ftpfs_proxy_host);
ftpfs_proxy_host = ret_ftp_proxy;
ftpfs_directory_timeout = atoi(ret_directory_timeout);
use_netrc = ret_use_netrc;

Просмотреть файл

@ -405,10 +405,9 @@ void find_cmd (void)
static void
set_panel_filter_to (WPanel *p, char *allocated_filter_string)
{
if (p->filter){
g_free (p->filter);
p->filter = 0;
}
g_free (p->filter);
p->filter = 0;
if (!(allocated_filter_string [0] == '*' && allocated_filter_string [1] == 0))
p->filter = allocated_filter_string;
else
@ -970,11 +969,10 @@ do_link (int symbolic_link, const char *fname)
}
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
repaint_screen ();
cleanup:
if (src != NULL)
g_free (src);
if (dest != NULL)
g_free (dest);
g_free (src);
g_free (dest);
}
void link_cmd (void)
@ -1205,8 +1203,7 @@ void quick_cd_cmd (void)
do_cd_command (q);
g_free (q);
}
if (p)
g_free (p);
g_free (p);
}
void

Просмотреть файл

@ -458,10 +458,8 @@ done_colors (void)
for (p = c.next; p; p = next) {
next = p->next;
if (p->fg)
g_free (p->fg);
if (p->bg)
g_free (p->bg);
g_free (p->fg);
g_free (p->bg);
g_free (p);
}
c.next = NULL;

Просмотреть файл

@ -804,9 +804,7 @@ destroy_dlg (Dlg_head *h)
c = h->current;
for (i = 0; i < h->count; i++) {
c = c->next;
if (h->current) {
g_free (h->current);
}
g_free (h->current);
h->current = c;
}
g_free (h->title);

Просмотреть файл

@ -544,8 +544,7 @@ alloc_dir_copy (int size)
if (dir_copy.list){
for (i = 0; i < dir_copy.size; i++) {
if (dir_copy.list [i].fname)
g_free (dir_copy.list [i].fname);
g_free (dir_copy.list [i].fname);
}
g_free (dir_copy.list);
dir_copy.list = 0;

Просмотреть файл

@ -52,10 +52,8 @@ static char *data = NULL;
void
flush_extension_file (void)
{
if (data) {
g_free (data);
data = NULL;
}
g_free (data);
data = NULL;
}
typedef char *(*quote_func_t) (const char *name, int quote_percent);

Просмотреть файл

@ -774,8 +774,7 @@ copy_file_file (FileOpContext *ctx, const char *src_path, const char *dst_path,
dst_status = DEST_FULL; /* copy successful, don't remove target file */
ret:
if (buf)
g_free (buf);
g_free (buf);
while (src_desc != -1 && mc_close (src_desc) < 0) {
temp_status =
@ -2011,8 +2010,7 @@ panel_operate (void *source_panel, FileOperation operation,
src_stat = panel->dir.list[i].st;
#ifdef WITH_FULL_PATHS
if (source_with_path)
g_free (source_with_path);
g_free (source_with_path);
source_with_path = concat_dir_and_file (panel->cwd, source);
#endif /* WITH_FULL_PATHS */
@ -2106,17 +2104,11 @@ panel_operate (void *source_panel, FileOperation operation,
free_linklist (&linklist);
free_linklist (&dest_dirs);
#ifdef WITH_FULL_PATHS
if (source_with_path)
g_free (source_with_path);
g_free (source_with_path);
#endif /* WITH_FULL_PATHS */
if (dest)
g_free (dest);
if (ctx->dest_mask) {
g_free (ctx->dest_mask);
ctx->dest_mask = NULL;
}
g_free (dest);
g_free (ctx->dest_mask);
ctx->dest_mask = NULL;
#ifdef WITH_BACKGROUND
/* Let our parent know we are saying bye bye */
if (we_are_background) {

Просмотреть файл

@ -1025,11 +1025,9 @@ static void remove_group (struct hotlist *grp)
if (current->type == HL_TYPE_GROUP)
remove_group (current);
if (current->label)
g_free (current->label);
if (current->directory)
g_free (current->directory);
g_free (current);
g_free (current->label);
g_free (current->directory);
g_free (current);
current = next;
}
@ -1061,10 +1059,8 @@ static void remove_from_hotlist (struct hotlist *entry)
unlink_entry (entry);
if (entry->label)
g_free (entry->label);
if (entry->directory)
g_free (entry->directory);
g_free (entry->label);
g_free (entry->directory);
g_free (entry);
/* now remove list entry from screen */
listbox_remove_current (l_hotlist, 1);
@ -1564,20 +1560,16 @@ void done_hotlist (void)
{
if (hotlist){
remove_group (hotlist);
if (hotlist->label)
g_free (hotlist->label);
if (hotlist->directory)
g_free (hotlist->directory);
g_free (hotlist);
g_free (hotlist->label);
g_free (hotlist->directory);
g_free (hotlist);
hotlist = 0;
}
hotlist_state.loaded = 0;
if (hotlist_file_name){
g_free (hotlist_file_name);
hotlist_file_name = 0;
}
g_free (hotlist_file_name);
hotlist_file_name = 0;
l_hotlist = 0;
current_group = 0;
if (tkn_buf){

Просмотреть файл

@ -2286,10 +2286,8 @@ main (int argc, char *argv[])
#ifdef HAVE_CHARSET
free_codepages_list ();
#endif
if (this_dir)
g_free (this_dir);
if (other_dir)
g_free (other_dir);
g_free (this_dir);
g_free (other_dir);
return 0;
}

Просмотреть файл

@ -386,16 +386,12 @@ panel_load_setup (WPanel *panel, const char *section)
}
/* User formats */
if (panel->user_format){
g_free (panel->user_format);
panel->user_format = 0;
}
g_free (panel->user_format);
panel->user_format = g_strdup (get_profile_string (section, "user_format",
DEFAULT_USER_FORMAT,
profile_name));
for (i = 0; i < LIST_TYPES; i++){
if (panel->user_status_format [i])
g_free (panel->user_status_format [i]);
g_free (panel->user_status_format [i]);
g_snprintf (buffer, sizeof (buffer), "user_status%d", i);
panel->user_status_format [i] =
g_strdup (get_profile_string (section, buffer,

Просмотреть файл

@ -120,10 +120,8 @@ static void tree_destroy (WTree *tree)
tree_store_remove_entry_remove_hook (remove_callback);
save_tree (tree);
if (tree->tree_shown){
g_free (tree->tree_shown);
tree->tree_shown = 0;
}
g_free (tree->tree_shown);
tree->tree_shown = 0;
tree->selected_ptr = NULL;
}
@ -202,8 +200,7 @@ static void show_tree (WTree *tree)
x = y = 1;
}
if (tree->tree_shown)
g_free (tree->tree_shown);
g_free (tree->tree_shown);
tree->tree_shown = g_new (tree_entry*, tree_lines);
for (i = 0; i < tree_lines; i++)

Просмотреть файл

@ -809,8 +809,7 @@ user_menu_cmd (struct WEdit *edit_widget)
easy_patterns = old_patterns;
g_free (menu);
menu = NULL;
if (entries)
g_free (entries);
g_free (entries);
g_free (data);
}

Просмотреть файл

@ -150,8 +150,7 @@ static char *i_cache_match (int id, int_cache *cache, int size)
static void i_cache_add (int id, int_cache *cache, int size, char *text,
int *last)
{
if (cache [*last].string)
g_free (cache [*last].string);
g_free (cache [*last].string);
cache [*last].string = g_strdup (text);
cache [*last].index = id;
*last = ((*last)+1) % size;
@ -653,8 +652,7 @@ putenv (char *string)
size * sizeof (char *));
new_environ[size] = (char *) string;
new_environ[size + 1] = NULL;
if (last_environ != NULL)
g_free ((void *) last_environ);
g_free ((void *) last_environ);
last_environ = new_environ;
__environ = new_environ;
}

Просмотреть файл

@ -269,8 +269,7 @@ view_done (WView *view)
if (view->view_active) {
free_file (view);
g_free (view->filename);
if (view->command)
g_free (view->command);
g_free (view->command);
}
view->view_active = 0;
default_hex_mode = view->hex_mode;
@ -2107,8 +2106,7 @@ regexp_search (WView *view, int direction)
g_free (regexp);
return;
}
if (old)
g_free (old);
g_free (old);
old = regexp;
#if 0
/* Mhm, do we really need to load all the file in the core? */
@ -2184,8 +2182,7 @@ normal_search (WView *view, int direction)
return;
}
if (old)
g_free (old);
g_free (old);
old = exp;
convert_from_input (exp);
@ -2220,8 +2217,7 @@ change_viewer (WView *view)
view_done (view);
view_init (view, t, s, 0);
g_free (s);
if (t)
g_free (t);
g_free (t);
view_labels (view);
view->dirty++;
view_update (view, TRUE);

Просмотреть файл

@ -555,9 +555,8 @@ label_set_text (WLabel *label, const char *text)
if (label->text && text && !strcmp (label->text, text))
return; /* Flickering is not nice */
if (label->text){
g_free (label->text);
}
g_free (label->text);
if (text){
label->text = g_strdup (text);
if (label->auto_adjust_cols) {
@ -2304,8 +2303,7 @@ buttonbar_new (int visible)
static void
set_label_text (WButtonBar * bb, int index, const char *text)
{
if (bb->labels[index - 1].text)
g_free (bb->labels[index - 1].text);
g_free (bb->labels[index - 1].text);
bb->labels[index - 1].text = g_strdup (text);
}