aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2016-07-10 18:41:23 +0200
committerMartin Kaiser <wireshark@kaiser.cx>2016-07-10 16:43:05 +0000
commitfac8f1f1bd4b0cb41bcce5e9777376ad3c119f45 (patch)
tree4762cb4c93eb954cda771968d6f4c5c02789be93
parent4b83805412d84e8c32742df75317f76728c998ed (diff)
pvfs2: clean up dissect_pvfs_distribution()
remove unnecessary variable initializers remove an unnecessary if (tree) check Change-Id: I4c5326c11efe4fe38fb606a45ca7674484e9421c Reviewed-on: https://code.wireshark.org/review/16371 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
-rw-r--r--epan/dissectors/packet-pvfs2.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/epan/dissectors/packet-pvfs2.c b/epan/dissectors/packet-pvfs2.c
index 16e9bff..563ed38 100644
--- a/epan/dissectors/packet-pvfs2.c
+++ b/epan/dissectors/packet-pvfs2.c
@@ -1147,11 +1147,12 @@ int dissect_pvfs_uint64(tvbuff_t *tvb, proto_tree *tree, int offset,
static int
dissect_pvfs_distribution(tvbuff_t *tvb, proto_tree *tree, int offset)
{
- proto_item *dist_item = NULL;
- proto_tree *dist_tree = NULL;
- guint32 distlen = 0;
- char *tmpstr = NULL;
+ proto_item *dist_item;
+ proto_tree *dist_tree;
+ guint32 distlen;
+ char *tmpstr;
guint8 issimplestripe = 0;
+ guint32 total_len;
/* Get distribution name length */
distlen = tvb_get_letohl(tvb, offset);
@@ -1159,28 +1160,23 @@ dissect_pvfs_distribution(tvbuff_t *tvb, proto_tree *tree, int offset)
/* Get distribution name */
tmpstr = (char *) tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 4, distlen, ENC_ASCII);
- if (tree)
- {
- guint32 total_len;
-
- /* 'distlen' does not include the NULL terminator */
- total_len = roundup8(4 + distlen + 1);
-
- if (((distlen + 1) == PVFS_DIST_SIMPLE_STRIPE_NAME_SIZE) &&
- (g_ascii_strncasecmp(tmpstr, PVFS_DIST_SIMPLE_STRIPE_NAME,
- distlen) == 0))
- {
- /* Parameter for 'simple_stripe' is 8 bytes */
- total_len += 8;
+ /* 'distlen' does not include the NULL terminator */
+ total_len = roundup8(4 + distlen + 1);
- issimplestripe = 1;
- }
+ if (((distlen + 1) == PVFS_DIST_SIMPLE_STRIPE_NAME_SIZE) &&
+ (g_ascii_strncasecmp(tmpstr, PVFS_DIST_SIMPLE_STRIPE_NAME,
+ distlen) == 0))
+ {
+ /* Parameter for 'simple_stripe' is 8 bytes */
+ total_len += 8;
- dist_item = proto_tree_add_string(tree, hf_pvfs_distribution, tvb, offset,
- total_len + 8, tmpstr);
- dist_tree = proto_item_add_subtree(dist_item, ett_pvfs_distribution);
+ issimplestripe = 1;
}
+ dist_item = proto_tree_add_string(tree, hf_pvfs_distribution,
+ tvb, offset, total_len + 8, tmpstr);
+ dist_tree = proto_item_add_subtree(dist_item, ett_pvfs_distribution);
+
/* io_dist */
offset = dissect_pvfs_string(tvb, dist_tree, hf_pvfs_io_dist, offset,
NULL);