Browse Source

* 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 20 years ago
parent
commit
68a7c1dfab
10 changed files with 62 additions and 61 deletions
  1. 30 0
      src/ChangeLog
  2. 1 2
      src/boxes.c
  3. 7 10
      src/cmd.c
  4. 2 4
      src/color.c
  5. 1 3
      src/dialog.c
  6. 1 2
      src/dir.c
  7. 2 4
      src/ext.c
  8. 6 14
      src/file.c
  9. 10 18
      src/hotlist.c
  10. 2 4
      src/main.c

+ 30 - 0
src/ChangeLog

@@ -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

+ 1 - 2
src/boxes.c

@@ -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;

+ 7 - 10
src/cmd.c

@@ -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 

+ 2 - 4
src/color.c

@@ -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;

+ 1 - 3
src/dialog.c

@@ -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);

+ 1 - 2
src/dir.c

@@ -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;

+ 2 - 4
src/ext.c

@@ -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);

+ 6 - 14
src/file.c

@@ -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) {

+ 10 - 18
src/hotlist.c

@@ -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){

+ 2 - 4
src/main.c

@@ -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;
 }

Some files were not shown because too many files changed in this diff