From 799d6fd057b0c20a7692a1181d811a8ff3a88d04 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sun, 15 Nov 2015 16:51:45 -0500 Subject: create_dissector_handle -> new_create_dissector_handle Picking off "easy" dissectors that only have one or two exit points at most. Change-Id: I96aa9cf53533cbb07105aa400d42922baf3016b3 Reviewed-on: https://code.wireshark.org/review/11860 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/dissectors/packet-ieee802a.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'epan/dissectors/packet-ieee802a.c') diff --git a/epan/dissectors/packet-ieee802a.c b/epan/dissectors/packet-ieee802a.c index 465a5c55ab..1ee75ac476 100644 --- a/epan/dissectors/packet-ieee802a.c +++ b/epan/dissectors/packet-ieee802a.c @@ -76,8 +76,8 @@ ieee802a_add_oui(guint32 oui, const char *table_name, const char *table_ui_name, g_hash_table_insert(oui_info_table, GUINT_TO_POINTER(oui), new_info); } -static void -dissect_ieee802a(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ieee802a(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *ieee802a_tree; proto_item *ti; @@ -128,16 +128,15 @@ dissect_ieee802a(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hf = hf_ieee802a_pid; subdissector_table = NULL; } - if (tree) - proto_tree_add_uint(ieee802a_tree, hf, tvb, 3, 2, pid); + + proto_tree_add_uint(ieee802a_tree, hf, tvb, 3, 2, pid); next_tvb = tvb_new_subset_remaining(tvb, 5); - if (subdissector_table != NULL) { + if ((subdissector_table == NULL) || /* do lookup with the subdissector table */ - if (dissector_try_uint(subdissector_table, pid, next_tvb, - pinfo, tree)) - return; + (!dissector_try_uint(subdissector_table, pid, next_tvb, pinfo, tree))) { + call_dissector(data_handle, next_tvb, pinfo, tree); } - call_dissector(data_handle, next_tvb, pinfo, tree); + return tvb_captured_length(tvb); } void @@ -176,7 +175,7 @@ proto_reg_handoff_ieee802a(void) data_handle = find_dissector("data"); - ieee802a_handle = create_dissector_handle(dissect_ieee802a, + ieee802a_handle = new_create_dissector_handle(dissect_ieee802a, proto_ieee802a); dissector_add_uint("ethertype", ETHERTYPE_IEEE802_OUI_EXTENDED, ieee802a_handle); -- cgit v1.2.3