From 7820b2c1f88b207a8b1270b8c3cb3b797b7563d2 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 13 Jul 2012 10:29:48 +0200 Subject: 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 BUG: 839925 Change-Id: I10e4ecff16c3749fe17c2831c516737e08a3205a Reviewed-on: http://review.gluster.com/3661 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/performance/io-cache/src/io-cache.c | 8 ++------ xlators/performance/md-cache/src/md-cache.c | 6 ++---- xlators/performance/quick-read/src/quick-read.c | 16 ++++------------ xlators/performance/read-ahead/src/read-ahead.c | 4 +--- xlators/performance/symlink-cache/src/symlink-cache.c | 3 +-- xlators/performance/write-behind/src/write-behind.c | 7 ++----- 6 files changed, 12 insertions(+), 32 deletions(-) (limited to 'xlators/performance') diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index bdaf0f1b81a..6062f9a6863 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -1495,13 +1495,9 @@ ioc_get_priority_list (const char *opt_str, struct list_head *first) stripe_str = strtok_r (NULL, ",", &tmp_str); } out: - if (string != NULL) { - GF_FREE (string); - } + GF_FREE (string); - if (dup_str != NULL) { - GF_FREE (dup_str); - } + GF_FREE (dup_str); if (max_pri == -1) { list_for_each_entry_safe (curr, tmp, first, list) { diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c index cf1aee9d6b9..55923990d49 100644 --- a/xlators/performance/md-cache/src/md-cache.c +++ b/xlators/performance/md-cache/src/md-cache.c @@ -222,8 +222,7 @@ mdc_local_wipe (xlator_t *this, mdc_local_t *local) if (local->fd) fd_unref (local->fd); - if (local->linkname) - GF_FREE (local->linkname); + GF_FREE (local->linkname); if (local->xattr) dict_unref (local->xattr); @@ -249,8 +248,7 @@ mdc_inode_wipe (xlator_t *this, inode_t *inode) if (mdc->xattr) dict_unref (mdc->xattr); - if (mdc->linkname) - GF_FREE (mdc->linkname); + GF_FREE (mdc->linkname); GF_FREE (mdc); diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c index 6e4ce816ec7..349ea778902 100644 --- a/xlators/performance/quick-read/src/quick-read.c +++ b/xlators/performance/quick-read/src/quick-read.c @@ -29,9 +29,7 @@ qr_local_free (qr_local_t *local) call_stub_destroy (local->stub); } - if (local->path != NULL) { - GF_FREE (local->path); - } + GF_FREE (local->path); mem_put (local); @@ -1371,9 +1369,7 @@ out: } ret: - if (vector) { - GF_FREE (vector); - } + GF_FREE (vector); if (iobref) { iobref_unref (iobref); @@ -3754,13 +3750,9 @@ qr_get_priority_list (const char *opt_str, struct list_head *first) priority_str = strtok_r (NULL, ",", &tmp_str); } out: - if (string != NULL) { - GF_FREE (string); - } + GF_FREE (string); - if (dup_str != NULL) { - GF_FREE (dup_str); - } + GF_FREE (dup_str); if (max_pri == -1) { list_for_each_entry_safe (curr, tmp, first, list) { diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c index 61a07d04e96..7b23049d371 100644 --- a/xlators/performance/read-ahead/src/read-ahead.c +++ b/xlators/performance/read-ahead/src/read-ahead.c @@ -1071,9 +1071,7 @@ init (xlator_t *this) out: if (ret == -1) { - if (conf != NULL) { - GF_FREE (conf); - } + GF_FREE (conf); } return ret; diff --git a/xlators/performance/symlink-cache/src/symlink-cache.c b/xlators/performance/symlink-cache/src/symlink-cache.c index 2e1b7a9be4e..3b5fbc252ec 100644 --- a/xlators/performance/symlink-cache/src/symlink-cache.c +++ b/xlators/performance/symlink-cache/src/symlink-cache.c @@ -137,8 +137,7 @@ sc_cache_set (xlator_t *this, inode_t *inode, struct iatt *buf, err: if (sc) { - if (sc->readlink) - FREE (sc->readlink); + FREE (sc->readlink); sc->readlink = NULL; FREE (sc); } diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index a743039d9ab..81a254df6a0 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -577,9 +577,7 @@ out: iobref_unref (iobref); } - if (vector != NULL) { - GF_FREE (vector); - } + GF_FREE (vector); if (bytes == -1) { /* @@ -2963,8 +2961,7 @@ init (xlator_t *this) out: if (ret) { - if (conf) - GF_FREE (conf); + GF_FREE (conf); } return ret; } -- cgit