summaryrefslogtreecommitdiffstats
path: root/xlators/debug
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/debug
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/debug')
-rw-r--r--xlators/debug/io-stats/src/io-stats.c15
-rw-r--r--xlators/debug/trace/src/trace.c126
2 files changed, 47 insertions, 94 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index 2cf28f1ccff..1057ace853c 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -1541,8 +1541,7 @@ io_stats_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
unwind:
/* local is assigned with path */
- if (frame->local)
- GF_FREE (frame->local);
+ GF_FREE (frame->local);
frame->local = NULL;
STACK_UNWIND_STRICT (mkdir, frame, op_ret, op_errno, inode, buf,
preparent, postparent, xdata);
@@ -2435,8 +2434,7 @@ io_stats_release (xlator_t *this, fd_t *fd)
if (iosfd) {
io_stats_dump_fd (this, iosfd);
- if (iosfd->filename)
- GF_FREE (iosfd->filename);
+ GF_FREE (iosfd->filename);
GF_FREE (iosfd);
}
@@ -2524,8 +2522,7 @@ ios_destroy_top_stats (struct ios_conf *conf)
stat = list->iosstat;
ios_stat_unref (stat);
list_del (&list->list);
- if (list)
- GF_FREE (list);
+ GF_FREE (list);
list_head->members--;
}
}
@@ -2540,8 +2537,7 @@ ios_destroy_top_stats (struct ios_conf *conf)
stat = list->iosstat;
ios_stat_unref (stat);
list_del (&list->list);
- if (list)
- GF_FREE (list);
+ GF_FREE (list);
list_head->members--;
}
}
@@ -2699,8 +2695,7 @@ fini (xlator_t *this)
ios_destroy_top_stats (conf);
- if (conf)
- GF_FREE(conf);
+ GF_FREE(conf);
gf_log (this->name, GF_LOG_INFO,
"io-stats translator unloaded");
diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c
index a1136a2e5b5..97f61ca59cb 100644
--- a/xlators/debug/trace/src/trace.c
+++ b/xlators/debug/trace/src/trace.c
@@ -105,12 +105,9 @@ trace_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
uuid_utoa (inode->gfid), op_ret, fd,
statstr, preparentstr, postparentstr);
- if (statstr)
- GF_FREE (statstr);
- if (preparentstr)
- GF_FREE (preparentstr);
- if (postparentstr)
- GF_FREE (postparentstr);
+ GF_FREE (statstr);
+ GF_FREE (preparentstr);
+ GF_FREE (postparentstr);
/* for 'release' log */
fd_ctx_set (fd, this, 0);
@@ -162,8 +159,7 @@ trace_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, uuid_utoa (frame->local),
op_ret, statstr);
- if (statstr)
- GF_FREE (statstr);
+ GF_FREE (statstr);
} else {
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": gfid=%s op_ret=%d, op_errno=%d)",
@@ -192,8 +188,7 @@ trace_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, uuid_utoa (frame->local),
op_ret, statstr);
- if (statstr)
- GF_FREE (statstr);
+ GF_FREE (statstr);
} else {
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": gfid=%s op_ret=%d, op_errno=%d)",
@@ -228,11 +223,9 @@ trace_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, op_ret,
preopstr, postopstr);
- if (preopstr)
- GF_FREE (preopstr);
+ GF_FREE (preopstr);
- if (postopstr)
- GF_FREE (postopstr);
+ GF_FREE (postopstr);
} else {
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": gfid=%s op_ret=%d, op_errno=%d",
@@ -301,11 +294,9 @@ trace_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, op_ret,
preopstr, postopstr);
- if (preopstr)
- GF_FREE (preopstr);
+ GF_FREE (preopstr);
- if (postopstr)
- GF_FREE (postopstr);
+ GF_FREE (postopstr);
} else {
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": gfid=%s op_ret=%d, op_errno=%d",
@@ -340,11 +331,9 @@ trace_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, op_ret,
preopstr, postopstr);
- if (preopstr)
- GF_FREE (preopstr);
+ GF_FREE (preopstr);
- if (postopstr)
- GF_FREE (postopstr);
+ GF_FREE (postopstr);
} else {
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": gfid=%s op_ret=%d, op_errno=%d)",
@@ -377,11 +366,9 @@ trace_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, op_ret,
preopstr, postopstr);
- if (preopstr)
- GF_FREE (preopstr);
+ GF_FREE (preopstr);
- if (postopstr)
- GF_FREE (postopstr);
+ GF_FREE (postopstr);
} else {
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": gfid=%s op_ret=%d, op_errno=%d)",
@@ -415,11 +402,9 @@ trace_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, uuid_utoa (frame->local), op_ret, preparentstr,
postparentstr);
- if (preparentstr)
- GF_FREE (preparentstr);
+ GF_FREE (preparentstr);
- if (postparentstr)
- GF_FREE (postparentstr);
+ GF_FREE (postparentstr);
} else {
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": gfid=%s op_ret=%d, op_errno=%d)",
@@ -463,20 +448,15 @@ trace_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
preoldparentstr, postoldparentstr,
prenewparentstr, postnewparentstr);
- if (statstr)
- GF_FREE (statstr);
+ GF_FREE (statstr);
- if (preoldparentstr)
- GF_FREE (preoldparentstr);
+ GF_FREE (preoldparentstr);
- if (postoldparentstr)
- GF_FREE (postoldparentstr);
+ GF_FREE (postoldparentstr);
- if (prenewparentstr)
- GF_FREE (prenewparentstr);
+ GF_FREE (prenewparentstr);
- if (postnewparentstr)
- GF_FREE (postnewparentstr);
+ GF_FREE (postnewparentstr);
} else {
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": gfid=%s op_ret=%d, op_errno=%d",
@@ -515,8 +495,7 @@ trace_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, uuid_utoa (frame->local),
op_ret, op_errno);
- if (statstr)
- GF_FREE (statstr);
+ GF_FREE (statstr);
}
frame->local = NULL;
@@ -545,10 +524,8 @@ trace_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, uuid_utoa (inode->gfid),
op_ret, statstr, postparentstr);
- if (statstr)
- GF_FREE (statstr);
- if (postparentstr)
- GF_FREE (postparentstr);
+ GF_FREE (statstr);
+ GF_FREE (postparentstr);
/* For 'forget' */
inode_ctx_put (inode, this, 0);
@@ -590,14 +567,11 @@ trace_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, uuid_utoa (inode->gfid),
op_ret, statstr, preparentstr, postparentstr);
- if (statstr)
- GF_FREE (statstr);
+ GF_FREE (statstr);
- if (preparentstr)
- GF_FREE (preparentstr);
+ GF_FREE (preparentstr);
- if (postparentstr)
- GF_FREE (postparentstr);
+ GF_FREE (postparentstr);
} else {
gf_log (this->name, GF_LOG_INFO,
@@ -636,14 +610,11 @@ trace_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, uuid_utoa (inode->gfid),
op_ret, statstr, preparentstr, postparentstr);
- if (statstr)
- GF_FREE (statstr);
+ GF_FREE (statstr);
- if (preparentstr)
- GF_FREE (preparentstr);
+ GF_FREE (preparentstr);
- if (postparentstr)
- GF_FREE (postparentstr);
+ GF_FREE (postparentstr);
} else {
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": (op_ret=%d, op_errno=%d)",
@@ -681,14 +652,11 @@ trace_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, uuid_utoa (inode->gfid),
op_ret, statstr, preparentstr, postparentstr);
- if (statstr)
- GF_FREE (statstr);
+ GF_FREE (statstr);
- if (preparentstr)
- GF_FREE (preparentstr);
+ GF_FREE (preparentstr);
- if (postparentstr)
- GF_FREE (postparentstr);
+ GF_FREE (postparentstr);
} else {
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": (op_ret=%d, op_errno=%d)",
@@ -725,14 +693,11 @@ trace_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, op_ret,
statstr, preparentstr, postparentstr);
- if (statstr)
- GF_FREE (statstr);
+ GF_FREE (statstr);
- if (preparentstr)
- GF_FREE (preparentstr);
+ GF_FREE (preparentstr);
- if (postparentstr)
- GF_FREE (postparentstr);
+ GF_FREE (postparentstr);
} else {
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": gfid=%s op_ret=%d, op_errno=%d",
@@ -805,11 +770,9 @@ trace_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, uuid_utoa (frame->local),
op_ret, preparentstr, postparentstr);
- if (preparentstr)
- GF_FREE (preparentstr);
+ GF_FREE (preparentstr);
- if (postparentstr)
- GF_FREE (postparentstr);
+ GF_FREE (postparentstr);
} else {
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": gfid=%s op_ret=%d, op_errno=%d",
@@ -844,11 +807,9 @@ trace_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, op_ret, preopstr,
postopstr);
- if (preopstr)
- GF_FREE (preopstr);
+ GF_FREE (preopstr);
- if (postopstr)
- GF_FREE (postopstr);
+ GF_FREE (postopstr);
} else {
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": gfid=%s op_ret=%d, op_errno=%d",
@@ -1029,11 +990,9 @@ trace_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, op_ret,
prebufstr, postbufstr);
- if (prebufstr)
- GF_FREE (prebufstr);
+ GF_FREE (prebufstr);
- if (postbufstr)
- GF_FREE (postbufstr);
+ GF_FREE (postbufstr);
} else {
gf_log (this->name, GF_LOG_INFO,
@@ -1063,8 +1022,7 @@ trace_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
frame->root->unique, uuid_utoa (frame->local),
op_ret, statstr);
- if (statstr)
- GF_FREE (statstr);
+ GF_FREE (statstr);
} else {
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": gfid=%s op_ret=%d, op_errno=%d",