diff options
author | Bill Meier <wmeier@newsguy.com> | 2012-09-28 19:50:49 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2012-09-28 19:50:49 +0000 |
commit | 562c8905607f4e8ccbcefee2da84fff9f7c5c6cb (patch) | |
tree | dcd5d665b94a451e851b1c250af8df60b5690778 /epan/dissectors/packet-pw-eth.c | |
parent | da4b39e720b46046ee5c0d42fd2c16f163f334d5 (diff) |
Cleanup:
packet-mpls.c:
- refactor dissect_pw_ach();
- create/uer value_string_ext as appropriate;
- use call_dissector() rather than direct dissector call in one cse;
all:
- use 'LABEL' prefix for a set of rather generic enum identifiers;
- fix some cases of calling expert...() or sub-dissectors under 'if(tree)';
- reformat some hf[] entries;
- do some whitespace changes.
svn path=/trunk/; revision=45195
Diffstat (limited to 'epan/dissectors/packet-pw-eth.c')
-rw-r--r-- | epan/dissectors/packet-pw-eth.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/epan/dissectors/packet-pw-eth.c b/epan/dissectors/packet-pw-eth.c index f6071d0837..9a4d29c74f 100644 --- a/epan/dissectors/packet-pw-eth.c +++ b/epan/dissectors/packet-pw-eth.c @@ -52,10 +52,8 @@ static dissector_handle_t pw_eth_handle_nocw; static void dissect_pw_eth_cw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_tree *pw_eth_tree = NULL; - proto_item *ti = NULL; - tvbuff_t *next_tvb = NULL; - guint16 sequence_number = 0; + tvbuff_t *next_tvb; + guint16 sequence_number; if (tvb_reported_length_remaining(tvb, 0) < 4) { if (tree) @@ -70,6 +68,9 @@ dissect_pw_eth_cw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) sequence_number = tvb_get_ntohs(tvb, 2); if (tree) { + proto_tree *pw_eth_tree; + proto_item *ti; + ti = proto_tree_add_boolean(tree, hf_pw_eth_cw, tvb, 0, 0, TRUE); PROTO_ITEM_SET_HIDDEN(ti); @@ -77,9 +78,6 @@ dissect_pw_eth_cw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb, 0, 4, ENC_NA); pw_eth_tree = proto_item_add_subtree(ti, ett_pw_eth); - if (pw_eth_tree == NULL) - return; - proto_tree_add_uint_format(pw_eth_tree, hf_pw_eth_cw_sequence_number, tvb, 2, 2, sequence_number, @@ -112,10 +110,10 @@ dissect_pw_eth_cw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void dissect_pw_eth_nocw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - tvbuff_t *next_tvb = NULL; - proto_item *ti = NULL; + tvbuff_t *next_tvb; if (tree) { + proto_item *ti; ti = proto_tree_add_boolean(tree, hf_pw_eth, tvb, 0, 0, TRUE); PROTO_ITEM_SET_HIDDEN(ti); } @@ -135,8 +133,8 @@ dissect_pw_eth_nocw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static gboolean looks_like_plain_eth(tvbuff_t *tvb _U_) { - const gchar *manuf_name_da = NULL; - const gchar *manuf_name_sa = NULL; + const gchar *manuf_name_da; + const gchar *manuf_name_sa; if (tvb_reported_length_remaining(tvb, 0) < 14) { return FALSE; @@ -230,13 +228,13 @@ proto_reg_handoff_pw_eth(void) eth_withoutfcs_handle = find_dissector("eth_withoutfcs"); pw_eth_handle_cw = find_dissector("pw_eth_cw"); - dissector_add_uint("mpls.label", LABEL_INVALID, pw_eth_handle_cw); + dissector_add_uint("mpls.label", MPLS_LABEL_INVALID, pw_eth_handle_cw); pw_eth_handle_nocw = find_dissector("pw_eth_nocw"); - dissector_add_uint("mpls.label", LABEL_INVALID, pw_eth_handle_nocw); + dissector_add_uint("mpls.label", MPLS_LABEL_INVALID, pw_eth_handle_nocw); pw_eth_handle_heuristic = find_dissector("pw_eth_heuristic"); - dissector_add_uint("mpls.label", LABEL_INVALID, pw_eth_handle_heuristic); + dissector_add_uint("mpls.label", MPLS_LABEL_INVALID, pw_eth_handle_heuristic); } /* |