diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2018-04-10 17:06:52 +0800 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2018-04-10 14:26:40 +0000 |
commit | d9c9a15f9863f404a101103656718ff840864250 (patch) | |
tree | ea6a266986ba85ac4ea25dd47f60f27373e99d8d /epan/dissectors/packet-gsm_ipa.c | |
parent | 74f7374e9f46bdd76fdea052ccb339564a8a8ddf (diff) |
gsm_ipa: remove unnecessary if (tree) checks
Change-Id: I4d6bd9d296fcbd35551e3da9d60e20848865330b
Reviewed-on: https://code.wireshark.org/review/26846
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-gsm_ipa.c')
-rw-r--r-- | epan/dissectors/packet-gsm_ipa.c | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/epan/dissectors/packet-gsm_ipa.c b/epan/dissectors/packet-gsm_ipa.c index 67d254db9c..a8abece057 100644 --- a/epan/dissectors/packet-gsm_ipa.c +++ b/epan/dissectors/packet-gsm_ipa.c @@ -203,17 +203,15 @@ dissect_ipaccess(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(msg_type, ipaccess_msgtype_vals, "unknown 0x%02x")); - if (tree) { - ti = proto_tree_add_item(tree, proto_ipaccess, tvb, 0, -1, ENC_NA); - ipaccess_tree = proto_item_add_subtree(ti, ett_ipaccess); - proto_tree_add_item(ipaccess_tree, hf_ipaccess_msgtype, - tvb, 0, 1, ENC_BIG_ENDIAN); - switch (msg_type) { + ti = proto_tree_add_item(tree, proto_ipaccess, tvb, 0, -1, ENC_NA); + ipaccess_tree = proto_item_add_subtree(ti, ett_ipaccess); + proto_tree_add_item(ipaccess_tree, hf_ipaccess_msgtype, + tvb, 0, 1, ENC_BIG_ENDIAN); + switch (msg_type) { case 4: case 5: dissect_ipa_attr(tvb, 1, ipaccess_tree); break; - } } return 1; @@ -248,9 +246,7 @@ dissect_osmo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ipatree, proto_tree return 1; /* Simply display the CTRL data as text */ } else if (osmo_proto == IPAC_PROTO_EXT_CTRL) { - if (tree) { - proto_tree_add_item(tree, hf_ipa_osmo_ctrl_data, next_tvb, 0, -1, ENC_ASCII|ENC_NA); - } + proto_tree_add_item(tree, hf_ipa_osmo_ctrl_data, next_tvb, 0, -1, ENC_ASCII|ENC_NA); return 1; } @@ -295,18 +291,16 @@ dissect_ipa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_udp header_length++; } - if (tree) { - ti = proto_tree_add_protocol_format(tree, proto_ipa, - tvb, offset, len+header_length, - "IPA protocol ip.access, type: %s", - val_to_str(msg_type, ipa_protocol_vals, - "unknown 0x%02x")); - ipa_tree = proto_item_add_subtree(ti, ett_ipa); - proto_tree_add_item(ipa_tree, hf_ipa_data_len, - tvb, offset, 2, ENC_BIG_ENDIAN); - proto_tree_add_item(ipa_tree, hf_ipa_protocol, - tvb, offset+2, 1, ENC_BIG_ENDIAN); - } + ti = proto_tree_add_protocol_format(tree, proto_ipa, + tvb, offset, len+header_length, + "IPA protocol ip.access, type: %s", + val_to_str(msg_type, ipa_protocol_vals, + "unknown 0x%02x")); + ipa_tree = proto_item_add_subtree(ti, ett_ipa); + proto_tree_add_item(ipa_tree, hf_ipa_data_len, + tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(ipa_tree, hf_ipa_protocol, + tvb, offset+2, 1, ENC_BIG_ENDIAN); next_tvb = tvb_new_subset_length(tvb, offset+header_length, len); @@ -332,13 +326,11 @@ dissect_ipa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_udp dissect_osmo(next_tvb, pinfo, ipa_tree, tree, ti); break; case HSL_DEBUG: - if (tree) { - proto_tree_add_item(ipa_tree, hf_ipa_hsl_debug, - next_tvb, 0, len, ENC_ASCII|ENC_NA); - if (global_ipa_in_root == TRUE) - proto_tree_add_item(tree, hf_ipa_hsl_debug, - next_tvb, 0, len, ENC_ASCII|ENC_NA); - } + proto_tree_add_item(ipa_tree, hf_ipa_hsl_debug, + next_tvb, 0, len, ENC_ASCII|ENC_NA); + if (global_ipa_in_root == TRUE) + proto_tree_add_item(tree, hf_ipa_hsl_debug, + next_tvb, 0, len, ENC_ASCII|ENC_NA); if (global_ipa_in_info == TRUE) col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", tvb_get_stringz_enc(wmem_packet_scope(), next_tvb, 0, NULL, ENC_ASCII)); |