diff options
author | Jim Meyering <meyering@redhat.com> | 2012-07-13 10:29:48 +0200 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-07-13 14:03:42 -0700 |
commit | 7820b2c1f88b207a8b1270b8c3cb3b797b7563d2 (patch) | |
tree | 5a383d85eb18399cf7506a90cc7627c749ccf9b8 /xlators/cluster/dht | |
parent | 2dc0d32e5d8b205fa407073b209bb663d546dde8 (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/cluster/dht')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 3 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-helper.c | 23 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 6 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-selfheal.c | 6 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht.c | 21 | ||||
-rw-r--r-- | xlators/cluster/dht/src/nufa.c | 15 | ||||
-rw-r--r-- | xlators/cluster/dht/src/switch.c | 30 |
7 files changed, 34 insertions, 70 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index eaafc2bfb3e..51e2c37ae37 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -1784,8 +1784,7 @@ dht_vgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, ret = dict_set_dynstr (dict, local->xsel, xattr_buf); - if (local->xattr_val) - GF_FREE (local->xattr_val); + GF_FREE (local->xattr_val); DHT_STACK_UNWIND (getxattr, frame, op_ret, op_errno, dict, xdata); diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index 611de19e48e..f0e74a15423 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -120,10 +120,8 @@ dht_filter_loc_subvol_key (xlator_t *this, loc_t *loc, loc_t *new_loc, out: if (!ret) { /* !success */ - if (new_path) - GF_FREE (new_path); - if (new_name) - GF_FREE (new_name); + GF_FREE (new_path); + GF_FREE (new_name); } return ret; } @@ -206,16 +204,11 @@ dht_local_wipe (xlator_t *this, dht_local_t *local) local->selfheal.layout = NULL; } - if (local->newpath) { - GF_FREE (local->newpath); - } + GF_FREE (local->newpath); - if (local->key) { - GF_FREE (local->key); - } + GF_FREE (local->key); - if (local->rebalance.vector) - GF_FREE (local->rebalance.vector); + GF_FREE (local->rebalance.vector); if (local->rebalance.iobref) iobref_unref (local->rebalance.iobref); @@ -750,8 +743,7 @@ dht_migration_complete_check_task (void *data) tmp_loc.path = path; ret = syncop_open (dst_node, &tmp_loc, local->fd->flags, local->fd); - if (path) - GF_FREE (path); + GF_FREE (path); } if (ret == -1) { @@ -874,8 +866,7 @@ dht_rebalance_inprogress_task (void *data) tmp_loc.path = path; ret = syncop_open (dst_node, &tmp_loc, local->fd->flags, local->fd); - if (path) - GF_FREE (path); + GF_FREE (path); } if (ret == -1) { diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index d2a59cc4312..e33875ffcfc 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -408,8 +408,7 @@ __dht_rebalance_migrate_data (xlator_t *from, xlator_t *to, fd_t *src, fd_t *dst offset += ret; total += ret; - if (vector) - GF_FREE (vector); + GF_FREE (vector); if (iobref) iobref_unref (iobref); iobref = NULL; @@ -417,8 +416,7 @@ __dht_rebalance_migrate_data (xlator_t *from, xlator_t *to, fd_t *src, fd_t *dst } if (iobref) iobref_unref (iobref); - if (vector) - GF_FREE (vector); + GF_FREE (vector); if (ret >= 0) ret = 0; diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index 7ceb80157d5..8b7d15ce520 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -182,8 +182,7 @@ err: if (xattr) dict_destroy (xattr); - if (disk_layout) - GF_FREE (disk_layout); + GF_FREE (disk_layout); dht_selfheal_dir_xattr_cbk (frame, subvol, frame->this, -1, ENOMEM, NULL); @@ -703,8 +702,7 @@ done: local->layout = new_layout; } - if (fix_array) - GF_FREE (fix_array); + GF_FREE (fix_array); return local->layout; } diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c index c5128544279..6b156c1d354 100644 --- a/xlators/cluster/dht/src/dht.c +++ b/xlators/cluster/dht/src/dht.c @@ -213,11 +213,9 @@ fini (xlator_t *this) GF_FREE (conf->file_layouts); } - if (conf->subvolumes) - GF_FREE (conf->subvolumes); + GF_FREE (conf->subvolumes); - if (conf->subvolume_status) - GF_FREE (conf->subvolume_status); + GF_FREE (conf->subvolume_status); GF_FREE (conf); } @@ -280,8 +278,7 @@ dht_parse_decommissioned_bricks (xlator_t *this, dht_conf_t *conf, ret = 0; conf->decommission_in_progress = 1; out: - if (dup_brick) - GF_FREE (dup_brick); + GF_FREE (dup_brick); return ret; } @@ -483,17 +480,13 @@ err: GF_FREE (conf->file_layouts); } - if (conf->subvolumes) - GF_FREE (conf->subvolumes); + GF_FREE (conf->subvolumes); - if (conf->subvolume_status) - GF_FREE (conf->subvolume_status); + GF_FREE (conf->subvolume_status); - if (conf->du_stats) - GF_FREE (conf->du_stats); + GF_FREE (conf->du_stats); - if (conf->defrag) - GF_FREE (conf->defrag); + GF_FREE (conf->defrag); GF_FREE (conf); } diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c index 2179870d9ad..53c66aa45aa 100644 --- a/xlators/cluster/dht/src/nufa.c +++ b/xlators/cluster/dht/src/nufa.c @@ -481,11 +481,9 @@ fini (xlator_t *this) GF_FREE (conf->file_layouts); } - if (conf->subvolumes) - GF_FREE (conf->subvolumes); + GF_FREE (conf->subvolumes); - if (conf->subvolume_status) - GF_FREE (conf->subvolume_status); + GF_FREE (conf->subvolume_status); GF_FREE (conf); } @@ -629,14 +627,11 @@ err: GF_FREE (conf->file_layouts); } - if (conf->subvolumes) - GF_FREE (conf->subvolumes); + GF_FREE (conf->subvolumes); - if (conf->subvolume_status) - GF_FREE (conf->subvolume_status); + GF_FREE (conf->subvolume_status); - if (conf->du_stats) - GF_FREE (conf->du_stats); + GF_FREE (conf->du_stats); GF_FREE (conf); } diff --git a/xlators/cluster/dht/src/switch.c b/xlators/cluster/dht/src/switch.c index ab261da870f..0542d7f9afc 100644 --- a/xlators/cluster/dht/src/switch.c +++ b/xlators/cluster/dht/src/switch.c @@ -95,8 +95,7 @@ get_switch_matching_subvol (const char *path, dht_conf_t *conf, trav = trav->next; } out: - if (pathname) - GF_FREE (pathname); + GF_FREE (pathname); return subvol; } @@ -589,8 +588,7 @@ fini (xlator_t *this) trav = (struct switch_struct *)conf->private; conf->private = NULL; while (trav) { - if (trav->array) - GF_FREE (trav->array); + GF_FREE (trav->array); prev = trav; trav = trav->next; GF_FREE (prev); @@ -603,11 +601,9 @@ fini (xlator_t *this) GF_FREE (conf->file_layouts); } - if (conf->subvolumes) - GF_FREE (conf->subvolumes); + GF_FREE (conf->subvolumes); - if (conf->subvolume_status) - GF_FREE (conf->subvolume_status); + GF_FREE (conf->subvolume_status); GF_FREE (conf); } @@ -822,16 +818,13 @@ set_switch_pattern (xlator_t *this, dht_conf_t *conf, return 0; err: - if (switch_buf_array) - GF_FREE (switch_buf_array); - if (switch_opt) - GF_FREE (switch_opt); + GF_FREE (switch_buf_array); + GF_FREE (switch_opt); if (switch_buf) { trav = switch_buf; while (trav) { - if (trav->array) - GF_FREE (trav->array); + GF_FREE (trav->array); switch_opt = trav; trav = trav->next; GF_FREE (switch_opt); @@ -954,14 +947,11 @@ err: GF_FREE (conf->file_layouts); } - if (conf->subvolumes) - GF_FREE (conf->subvolumes); + GF_FREE (conf->subvolumes); - if (conf->subvolume_status) - GF_FREE (conf->subvolume_status); + GF_FREE (conf->subvolume_status); - if (conf->du_stats) - GF_FREE (conf->du_stats); + GF_FREE (conf->du_stats); GF_FREE (conf); } |