diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2009-11-09 14:20:44 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2009-11-09 14:20:44 +0000 |
commit | 5b7e0dcd9e0df3bb4247c29083a25e9dcc12b344 (patch) | |
tree | 3739b72ad54cc63bf88b436ffedb541de15fe441 | |
parent | 8fe96a84e09f6062fee2997b5ff49dc3b01811ea (diff) | |
download | wireshark-5b7e0dcd9e0df3bb4247c29083a25e9dcc12b344.tar.gz wireshark-5b7e0dcd9e0df3bb4247c29083a25e9dcc12b344.tar.bz2 wireshark-5b7e0dcd9e0df3bb4247c29083a25e9dcc12b344.zip |
Put tree elements in the arcnet subtree.
Some code cleanup.
svn path=/trunk/; revision=30890
-rw-r--r-- | epan/dissectors/packet-arcnet.c | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/epan/dissectors/packet-arcnet.c b/epan/dissectors/packet-arcnet.c index 3f7747173f..2a82d1e2c9 100644 --- a/epan/dissectors/packet-arcnet.c +++ b/epan/dissectors/packet-arcnet.c @@ -153,30 +153,23 @@ dissect_arcnet_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, SET_ADDRESS(&pinfo->dl_dst, AT_ARCNET, 1, tvb_get_ptr(tvb, 1, 1)); SET_ADDRESS(&pinfo->dst, AT_ARCNET, 1, tvb_get_ptr(tvb, 1, 1)); - if (tree) - { - ti = - proto_tree_add_item (tree, proto_arcnet, tvb, 0, -1, FALSE); + ti = proto_tree_add_item (tree, proto_arcnet, tvb, 0, -1, FALSE); - arcnet_tree = proto_item_add_subtree (ti, ett_arcnet); + arcnet_tree = proto_item_add_subtree (ti, ett_arcnet); - proto_tree_add_uint (tree, hf_arcnet_src, tvb, offset, 1, src); - } + proto_tree_add_uint (arcnet_tree, hf_arcnet_src, tvb, offset, 1, src); offset++; - if (tree) - proto_tree_add_uint (tree, hf_arcnet_dst, tvb, offset, 1, dst); + proto_tree_add_uint (arcnet_tree, hf_arcnet_dst, tvb, offset, 1, dst); offset++; if (has_offset) { - if (tree) - proto_tree_add_item (tree, hf_arcnet_offset, tvb, offset, 2, FALSE); + proto_tree_add_item (arcnet_tree, hf_arcnet_offset, tvb, offset, 2, FALSE); offset += 2; } protID = tvb_get_guint8 (tvb, offset); - if (tree) - proto_tree_add_uint (tree, hf_arcnet_protID, tvb, offset, 1, protID); + proto_tree_add_uint (arcnet_tree, hf_arcnet_protID, tvb, offset, 1, protID); offset++; switch (protID) { @@ -220,40 +213,33 @@ dissect_arcnet_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, /* This is an exception packet. The flag value there is the "this is an exception flag" packet; the next two bytes after it are padding. */ - if (tree) { - proto_tree_add_uint (tree, hf_arcnet_exception_flag, tvb, offset, 1, + proto_tree_add_uint (arcnet_tree, hf_arcnet_exception_flag, tvb, offset, 1, split_flag); - } offset++; - if (tree) - proto_tree_add_text (tree, tvb, offset, 2, "Padding"); + proto_tree_add_text (arcnet_tree, tvb, offset, 2, "Padding"); offset += 2; /* Another copy of the packet type appears after the padding. */ - if (tree) - proto_tree_add_item (tree, hf_arcnet_protID, tvb, offset, 1, FALSE); + proto_tree_add_item (arcnet_tree, hf_arcnet_protID, tvb, offset, 1, FALSE); offset++; /* And after that comes the real split flag. */ split_flag = tvb_get_guint8 (tvb, offset); } - if (tree) { - proto_tree_add_uint (tree, hf_arcnet_split_flag, tvb, offset, 1, + + proto_tree_add_uint (arcnet_tree, hf_arcnet_split_flag, tvb, offset, 1, split_flag); - } offset++; - if (tree) - proto_tree_add_item (tree, hf_arcnet_sequence, tvb, offset, 2, FALSE); + proto_tree_add_item (arcnet_tree, hf_arcnet_sequence, tvb, offset, 2, FALSE); offset += 2; break; } /* Set the length of the ARCNET header protocol tree item. */ - if (tree) - proto_item_set_len(ti, offset); + proto_item_set_len(ti, offset); next_tvb = tvb_new_subset_remaining (tvb, offset); |