From f4b0abc7296bbb431e64e31f85b24c29196c2ae4 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Fri, 16 Dec 2016 20:06:11 -0500 Subject: Dissectors don't need a journey of self discovery. They already know who they are when they register themselves. Saving the handle then to avoid finding it later. Not sure if this will increase unnecessary register_dissector functions (instead of using create_dissector_handle in proto_reg_handoff function) when other dissectors copy/paste, but it should make startup time a few microseconds better. Change-Id: I3839be791b32b84887ac51a6a65fb5733e9f1f43 Reviewed-on: https://code.wireshark.org/review/19481 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-pw-satop.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'epan/dissectors/packet-pw-satop.c') diff --git a/epan/dissectors/packet-pw-satop.c b/epan/dissectors/packet-pw-satop.c index 5905bf9170..36802d95c8 100644 --- a/epan/dissectors/packet-pw-satop.c +++ b/epan/dissectors/packet-pw-satop.c @@ -62,6 +62,8 @@ static expert_field ei_cw_bits03 = EI_INIT; static expert_field ei_cw_packet_size_too_small = EI_INIT; static dissector_handle_t pw_padding_handle; +static dissector_handle_t pw_satop_udp_handle; + const char pwc_longname_pw_satop[] = "SAToP (no RTP support)"; static const char shortname[] = "SAToP (no RTP)"; @@ -459,8 +461,7 @@ void proto_register_pw_satop(void) proto_register_subtree_array(ett_array, array_length(ett_array)); expert_pwsatop = expert_register_protocol(proto); expert_register_field_array(expert_pwsatop, ei, array_length(ei)); - register_dissector("pw_satop_udp", dissect_pw_satop_udp, proto); - return; + pw_satop_udp_handle = register_dissector("pw_satop_udp", dissect_pw_satop_udp, proto); } void proto_reg_handoff_pw_satop(void) @@ -473,7 +474,7 @@ void proto_reg_handoff_pw_satop(void) pw_satop_mpls_handle = create_dissector_handle( dissect_pw_satop_mpls, proto ); dissector_add_for_decode_as("mpls.label", pw_satop_mpls_handle); - dissector_add_for_decode_as_with_preference("udp.port", find_dissector("pw_satop_udp")); + dissector_add_for_decode_as_with_preference("udp.port", pw_satop_udp_handle); } /* -- cgit v1.2.3