summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2012-07-13 10:29:48 +0200
committerAnand Avati <avati@redhat.com>2012-07-13 14:03:42 -0700
commit7820b2c1f88b207a8b1270b8c3cb3b797b7563d2 (patch)
tree5a383d85eb18399cf7506a90cc7627c749ccf9b8 /xlators/features
parent2dc0d32e5d8b205fa407073b209bb663d546dde8 (diff)
remove useless if-before-free (and free-like) functions
See comments in http://bugzilla.redhat.com/839925 for the code to perform this change. Signed-off-by: Jim Meyering <meyering@redhat.com> BUG: 839925 Change-Id: I10e4ecff16c3749fe17c2831c516737e08a3205a Reviewed-on: http://review.gluster.com/3661 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/locks/src/clear.c3
-rw-r--r--xlators/features/locks/src/common.c3
-rw-r--r--xlators/features/locks/src/entrylk.c15
-rw-r--r--xlators/features/locks/src/inodelk.c3
-rw-r--r--xlators/features/locks/src/posix.c15
-rw-r--r--xlators/features/marker/src/marker.c12
-rw-r--r--xlators/features/path-convertor/src/path.c3
-rw-r--r--xlators/features/quiesce/src/quiesce.c9
-rw-r--r--xlators/features/quota/src/quota.c3
-rw-r--r--xlators/features/trash/src/trash.c15
10 files changed, 27 insertions, 54 deletions
diff --git a/xlators/features/locks/src/clear.c b/xlators/features/locks/src/clear.c
index 5533c6bdcb9..015a9fe723e 100644
--- a/xlators/features/locks/src/clear.c
+++ b/xlators/features/locks/src/clear.c
@@ -149,8 +149,7 @@ clrlk_parse_args (const char* cmd, clrlk_args *args)
ret = 0;
out:
- if (free_ptr)
- GF_FREE (free_ptr);
+ GF_FREE (free_ptr);
return ret;
}
diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c
index f59d0882c1a..542043fe121 100644
--- a/xlators/features/locks/src/common.c
+++ b/xlators/features/locks/src/common.c
@@ -182,8 +182,7 @@ pl_print_lockee (char *str, int size, fd_t *fd, loc_t *loc)
uuid_utoa (inode->gfid), fd,
ipath ? ipath : "<nul>");
- if (ipath)
- GF_FREE (ipath);
+ GF_FREE (ipath);
}
diff --git a/xlators/features/locks/src/entrylk.c b/xlators/features/locks/src/entrylk.c
index 2a47657dbbb..2c4904ff3d7 100644
--- a/xlators/features/locks/src/entrylk.c
+++ b/xlators/features/locks/src/entrylk.c
@@ -341,8 +341,7 @@ __lock_name (pl_inode_t *pinode, const char *basename, entrylk_type type,
if (conf) {
ret = -EAGAIN;
if (nonblock){
- if (lock->basename)
- GF_FREE ((char *)lock->basename);
+ GF_FREE ((char *)lock->basename);
GF_FREE (lock);
goto out;
@@ -361,8 +360,7 @@ __lock_name (pl_inode_t *pinode, const char *basename, entrylk_type type,
if ( __blocked_lock_conflict (dom, basename, type) && !(__owner_has_lock (dom, lock))) {
ret = -EAGAIN;
if (nonblock) {
- if (lock->basename)
- GF_FREE ((char *) lock->basename);
+ GF_FREE ((char *) lock->basename);
GF_FREE (lock);
goto out;
@@ -499,8 +497,7 @@ __grant_blocked_entry_locks (xlator_t *this, pl_inode_t *pl_inode,
} else {
gf_log (this->name, GF_LOG_DEBUG,
"should never happen");
- if (bl->basename)
- GF_FREE ((char *)bl->basename);
+ GF_FREE ((char *)bl->basename);
GF_FREE (bl);
}
}
@@ -601,8 +598,7 @@ release_entry_locks_for_transport (xlator_t *this, pl_inode_t *pinode,
STACK_UNWIND_STRICT (entrylk, lock->frame, -1, EAGAIN, NULL);
- if (lock->basename)
- GF_FREE ((char *)lock->basename);
+ GF_FREE ((char *)lock->basename);
GF_FREE (lock);
}
@@ -612,8 +608,7 @@ release_entry_locks_for_transport (xlator_t *this, pl_inode_t *pinode,
STACK_UNWIND_STRICT (entrylk, lock->frame, 0, 0, NULL);
- if (lock->basename)
- GF_FREE ((char *)lock->basename);
+ GF_FREE ((char *)lock->basename);
GF_FREE (lock);
}
diff --git a/xlators/features/locks/src/inodelk.c b/xlators/features/locks/src/inodelk.c
index a2e65d55fc3..eba85795c20 100644
--- a/xlators/features/locks/src/inodelk.c
+++ b/xlators/features/locks/src/inodelk.c
@@ -454,8 +454,7 @@ release_inode_locks_of_transport (xlator_t *this, pl_dom_list_t *dom,
__pl_inodelk_unref (l);
}
}
- if (path)
- GF_FREE (path);
+ GF_FREE (path);
pthread_mutex_unlock (&pinode->mutex);
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index 3da40ffacac..09ce6377466 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -476,8 +476,7 @@ pl_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
out:
STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict, xdata);
- if (args.opts)
- GF_FREE (args.opts);
+ GF_FREE (args.opts);
if (op_ret && lk_summary)
GF_FREE (lk_summary);
if (dict)
@@ -1351,8 +1350,7 @@ pl_forget (xlator_t *this,
list_for_each_entry_safe (entry_l, entry_tmp, &dom->entrylk_list, domain_list) {
list_del_init (&entry_l->domain_list);
- if (entry_l->basename)
- GF_FREE ((char *)entry_l->basename);
+ GF_FREE ((char *)entry_l->basename);
GF_FREE (entry_l);
}
@@ -1385,8 +1383,7 @@ pl_forget (xlator_t *this,
list_for_each_entry_safe (entry_l, entry_tmp, &entrylks_released, blocked_locks) {
STACK_UNWIND_STRICT (entrylk, entry_l->frame, -1, 0, NULL);
- if (entry_l->basename)
- GF_FREE ((char *)entry_l->basename);
+ GF_FREE ((char *)entry_l->basename);
GF_FREE (entry_l);
}
@@ -2033,8 +2030,7 @@ pl_dump_inode_priv (xlator_t *this, inode_t *inode)
}
out:
- if (pathname)
- GF_FREE (pathname);
+ GF_FREE (pathname);
return ret;
}
@@ -2120,8 +2116,7 @@ init (xlator_t *this)
out:
if (ret) {
- if (priv)
- GF_FREE (priv);
+ GF_FREE (priv);
}
return ret;
}
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c
index 534437479a0..1b5abd572c3 100644
--- a/xlators/features/marker/src/marker.c
+++ b/xlators/features/marker/src/marker.c
@@ -117,8 +117,7 @@ err:
if (parent)
inode_unref (parent);
- if (resolvedpath)
- GF_FREE (resolvedpath);
+ GF_FREE (resolvedpath);
return ret;
}
@@ -2419,14 +2418,11 @@ marker_xtime_priv_cleanup (xlator_t *this)
GF_VALIDATE_OR_GOTO (this->name, priv, out);
- if (priv->volume_uuid != NULL)
- GF_FREE (priv->volume_uuid);
+ GF_FREE (priv->volume_uuid);
- if (priv->timestamp_file != NULL)
- GF_FREE (priv->timestamp_file);
+ GF_FREE (priv->timestamp_file);
- if (priv->marker_xattr != NULL)
- GF_FREE (priv->marker_xattr);
+ GF_FREE (priv->marker_xattr);
out:
return;
}
diff --git a/xlators/features/path-convertor/src/path.c b/xlators/features/path-convertor/src/path.c
index f2423092e56..22ec8fe1e65 100644
--- a/xlators/features/path-convertor/src/path.c
+++ b/xlators/features/path-convertor/src/path.c
@@ -848,8 +848,7 @@ path_setxattr (call_frame_t *frame,
if (tmp_path != loc_path)
GF_FREE (tmp_path);
- if (tmp_name)
- GF_FREE (tmp_name);
+ GF_FREE (tmp_name);
return 0;
}
diff --git a/xlators/features/quiesce/src/quiesce.c b/xlators/features/quiesce/src/quiesce.c
index d355a19fa7f..423ec6ffb10 100644
--- a/xlators/features/quiesce/src/quiesce.c
+++ b/xlators/features/quiesce/src/quiesce.c
@@ -41,16 +41,13 @@ gf_quiesce_local_wipe (xlator_t *this, quiesce_local_t *local)
loc_wipe (&local->loc);
if (local->fd)
fd_unref (local->fd);
- if (local->name)
- GF_FREE (local->name);
- if (local->volname)
- GF_FREE (local->volname);
+ GF_FREE (local->name);
+ GF_FREE (local->volname);
if (local->dict)
dict_unref (local->dict);
if (local->iobref)
iobref_unref (local->iobref);
- if (local->vector)
- GF_FREE (local->vector);
+ GF_FREE (local->vector);
mem_put (local);
}
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index a5ff2373fb6..55dd3d59dd9 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -497,8 +497,7 @@ quota_get_limit_value (inode_t *inode, xlator_t *this, int64_t *n)
}
out:
- if (path)
- GF_FREE (path);
+ GF_FREE (path);
return ret;
}
diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c
index 92ea19a55f3..ded65027114 100644
--- a/xlators/features/trash/src/trash.c
+++ b/xlators/features/trash/src/trash.c
@@ -170,8 +170,7 @@ trash_unlink_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
out:
GF_FREE (cookie);
- if (tmp_str)
- GF_FREE (tmp_str);
+ GF_FREE (tmp_str);
return 0;
}
@@ -442,8 +441,7 @@ trash_rename_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
out:
GF_FREE (cookie); /* strdup (dir_name) was sent here :) */
- if (tmp_str)
- GF_FREE (tmp_str);
+ GF_FREE (tmp_str);
return 0;
}
@@ -924,8 +922,7 @@ trash_truncate_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
out:
GF_FREE (cookie); /* strdup (dir_name) was sent here :) */
- if (tmp_str)
- GF_FREE (tmp_str);
+ GF_FREE (tmp_str);
return 0;
}
@@ -1287,8 +1284,7 @@ trash_ftruncate_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
out:
GF_FREE (cookie); /* strdup (dir_name) was sent here :) */
- if (tmp_str)
- GF_FREE (tmp_str);
+ GF_FREE (tmp_str);
return 0;
}
@@ -1522,8 +1518,7 @@ fini (xlator_t *this)
trash_private_t *priv = NULL;
priv = this->private;
- if (priv)
- GF_FREE (priv);
+ GF_FREE (priv);
return;
}