From c0608261780599cee2c8d2f94c1992f6148a17b2 Mon Sep 17 00:00:00 2001 From: "Andrew V. Samoilov" Date: Fri, 24 Sep 2004 23:00:18 +0000 Subject: [PATCH] * direntry.c (vfs_s_free_entry): g_free handles NULL argument too, no need for the comparison. * extfs.c (extfs_free_archive): Likewise. (extfs_open_archive): Likewise. (extfs_read_archive): Likewise. (extfs_remove_entry): Likewise. (extfs_free_entry): Likewise. * fish.c (fish_open_archive): Likewise. (fish_archive_same): Likewise. * ftpfs.c (ftpfs_split_url): Likewise. * local.c (local_closedir): Likewise. * mcserv.c (close_handle): Likewise. * smbfs.c (smbfs_free_bucket): Likewise. * tar.c (tar_read_header): Likewise. * undelfs.c (undelfs_shutdown): Likewise. * vfs.c (vfs_shut): Likewise. --- vfs/ChangeLog | 19 +++++++++++++++++++ vfs/direntry.c | 6 ++---- vfs/extfs.c | 15 +++++---------- vfs/fish.c | 6 ++---- vfs/ftpfs.c | 3 +-- vfs/local.c | 3 +-- vfs/mcserv.c | 3 +-- vfs/smbfs.c | 2 +- vfs/tar.c | 3 +-- vfs/undelfs.c | 9 +++------ vfs/vfs.c | 3 +-- 11 files changed, 37 insertions(+), 35 deletions(-) diff --git a/vfs/ChangeLog b/vfs/ChangeLog index 82c3db3d3..9f67937de 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,22 @@ +2004-09-25 Pavel S. Shirshov + + * direntry.c (vfs_s_free_entry): g_free handles NULL argument too, + no need for the comparison. + * extfs.c (extfs_free_archive): Likewise. + (extfs_open_archive): Likewise. + (extfs_read_archive): Likewise. + (extfs_remove_entry): Likewise. + (extfs_free_entry): Likewise. + * fish.c (fish_open_archive): Likewise. + (fish_archive_same): Likewise. + * ftpfs.c (ftpfs_split_url): Likewise. + * local.c (local_closedir): Likewise. + * mcserv.c (close_handle): Likewise. + * smbfs.c (smbfs_free_bucket): Likewise. + * tar.c (tar_read_header): Likewise. + * undelfs.c (undelfs_shutdown): Likewise. + * vfs.c (vfs_shut): Likewise. + 2004-09-24 Roland Illig * vfs.c (mc_open): Corrected FIXME. Now the "mode" parameter is diff --git a/vfs/direntry.c b/vfs/direntry.c index e17fb22ad..be1a43111 100644 --- a/vfs/direntry.c +++ b/vfs/direntry.c @@ -111,10 +111,8 @@ vfs_s_free_entry (struct vfs_class *me, struct vfs_s_entry *ent) ent->next->prevp = ent->prevp; } - if (ent->name){ - g_free (ent->name); - ent->name = NULL; - } + g_free (ent->name); + ent->name = NULL; if (ent->ino){ ent->ino->ent = NULL; diff --git a/vfs/extfs.c b/vfs/extfs.c index ea5cff22c..efdbc5665 100644 --- a/vfs/extfs.c +++ b/vfs/extfs.c @@ -207,8 +207,7 @@ static void extfs_free_archive (struct archive *archive) archive->local_stat.st_mtime != my.st_mtime); g_free(archive->local_name); } - if (archive->name) - g_free (archive->name); + g_free (archive->name); g_free (archive); } @@ -241,8 +240,7 @@ extfs_open_archive (int fstype, const char *name, struct archive **pparc) cmd = g_strconcat (mc_extfsdir, extfs_prefixes[fstype], " list ", local_name ? local_name : tmp, (char *) NULL); - if (tmp) - g_free (tmp); + g_free (tmp); g_free (mc_extfsdir); open_error_pipe (); result = popen (cmd, "r"); @@ -409,8 +407,7 @@ extfs_read_archive (int fstype, const char *name, struct archive **pparc) } read_extfs_continue: g_free (current_file_name); - if (current_link_name != NULL) - g_free (current_link_name); + g_free (current_link_name); } } @@ -1190,8 +1187,7 @@ static void extfs_remove_entry (struct entry *e) unlink (e->inode->local_filename); free (e->inode->local_filename); } - if (e->inode->linkname != NULL) - g_free (e->inode->linkname); + g_free (e->inode->linkname); g_free (e->inode); } @@ -1213,8 +1209,7 @@ static void extfs_free_entry (struct entry *e) unlink (e->inode->local_filename); free (e->inode->local_filename); } - if (e->inode->linkname != NULL) - g_free (e->inode->linkname); + g_free (e->inode->linkname); g_free (e->inode); } if (e->next_in_dir != NULL) diff --git a/vfs/fish.c b/vfs/fish.c index d14c7f27b..3ae67477d 100644 --- a/vfs/fish.c +++ b/vfs/fish.c @@ -311,8 +311,7 @@ fish_open_archive (struct vfs_class *me, struct vfs_s_super *super, p = vfs_split_url (strchr (op, ':') + 1, &host, &user, &flags, &password, 0, URL_NOSLASH); - if (p) - g_free (p); + g_free (p); SUP.host = host; SUP.user = user; @@ -335,8 +334,7 @@ fish_archive_same (struct vfs_class *me, struct vfs_s_super *super, op = vfs_split_url (strchr (op, ':') + 1, &host, &user, &flags, 0, 0, URL_NOSLASH); - if (op) - g_free (op); + g_free (op); flags = ((strcmp (host, SUP.host) == 0) && (strcmp (user, SUP.user) == 0) && (flags == SUP.flags)); diff --git a/vfs/ftpfs.c b/vfs/ftpfs.c index 7d4a07767..f5f2d6775 100644 --- a/vfs/ftpfs.c +++ b/vfs/ftpfs.c @@ -242,8 +242,7 @@ ftpfs_split_url(char *path, char **host, char **user, int *port, char **pass) g_free (new_user); } - if (p) - g_free (p); + g_free (p); } /* Returns a reply code, check /usr/include/arpa/ftp.h for possible values */ diff --git a/vfs/local.c b/vfs/local.c index 2d976b632..b6f920964 100644 --- a/vfs/local.c +++ b/vfs/local.c @@ -101,8 +101,7 @@ local_closedir (void *data) int i; i = closedir (* (DIR **) data); - if (data) - g_free (data); + g_free (data); return i; } diff --git a/vfs/mcserv.c b/vfs/mcserv.c index bc993dcff..b17557660 100644 --- a/vfs/mcserv.c +++ b/vfs/mcserv.c @@ -418,8 +418,7 @@ close_handle (int handle) mcfs_DIR.used--; if (mcfs_DIR.dirs[handle]) closedir (mcfs_DIR.dirs[handle]); - if (mcfs_DIR.names[handle]) - g_free (mcfs_DIR.names[handle]); + g_free (mcfs_DIR.names[handle]); mcfs_DIR.dirs[handle] = 0; mcfs_DIR.names[handle] = 0; } diff --git a/vfs/smbfs.c b/vfs/smbfs.c index 78a5b102c..b7cd54e55 100644 --- a/vfs/smbfs.c +++ b/vfs/smbfs.c @@ -1006,7 +1006,7 @@ smbfs_free_bucket (smbfs_connection *bucket) g_free (bucket->domain); g_free (bucket->user); wipe_password (bucket->password); - if (bucket->home) g_free (bucket->home); + g_free (bucket->home); memset (bucket, 0, sizeof (smbfs_connection)); } diff --git a/vfs/tar.c b/vfs/tar.c index 2b71476b0..e4e7eaedd 100644 --- a/vfs/tar.c +++ b/vfs/tar.c @@ -418,8 +418,7 @@ tar_read_header (struct vfs_class *me, struct vfs_s_super *archive, longp = ((header->header.linkflag == LF_LONGNAME) ? &next_long_name : &next_long_link); - if (*longp) - g_free (*longp); + g_free (*longp); bp = *longp = g_malloc (*h_size + 1); for (size = *h_size; size > 0; size -= written) { diff --git a/vfs/undelfs.c b/vfs/undelfs.c index d46d6899a..749fc43d4 100644 --- a/vfs/undelfs.c +++ b/vfs/undelfs.c @@ -94,14 +94,11 @@ undelfs_shutdown (void) if (fs) ext2fs_close (fs); fs = NULL; - if (ext2_fname) - g_free (ext2_fname); + g_free (ext2_fname); ext2_fname = NULL; - if (delarray) - g_free (delarray); + g_free (delarray); delarray = NULL; - if (block_buf) - g_free (block_buf); + g_free (block_buf); block_buf = NULL; } diff --git a/vfs/vfs.c b/vfs/vfs.c index 0e8919bb0..20819b084 100644 --- a/vfs/vfs.c +++ b/vfs/vfs.c @@ -949,8 +949,7 @@ vfs_shut (void) vfs_gc_done (); - if (current_dir) - g_free (current_dir); + g_free (current_dir); for (vfs = vfs_list; vfs; vfs = vfs->next) if (vfs->done)