From a062c802364fd83d43f934560149f2ddd1fee6a3 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Thu, 30 Jun 2016 20:41:45 -0400 Subject: ASN.1 dissectors - don't try to find yourself. If an ASN.1 dissector is calling register_dissector for itself in its proto_register_xxx function and then calling find_dissector for itself in its proto_reg_handoff_xxx function then just create a static handle for that dissector and use the return value of register_dissector, so the find isn't necessary. Change-Id: I911bdadc2fb4259601c141b955e741a2369cc447 Reviewed-on: https://code.wireshark.org/review/16233 Reviewed-by: Michael Mann Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-x2ap.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'epan/dissectors/packet-x2ap.c') diff --git a/epan/dissectors/packet-x2ap.c b/epan/dissectors/packet-x2ap.c index 9d97b2a2ba..3e24ac9168 100644 --- a/epan/dissectors/packet-x2ap.c +++ b/epan/dissectors/packet-x2ap.c @@ -777,6 +777,8 @@ static int dissect_SuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, pro static int dissect_UnsuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *); void proto_reg_handoff_x2ap(void); +static dissector_handle_t x2ap_handle; + /*--- Included file: packet-x2ap-fn.c ---*/ #line 1 "./asn1/x2ap/packet-x2ap-fn.c" @@ -6220,7 +6222,7 @@ static int dissect_X2AP_PDU_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto /*--- End of included file: packet-x2ap-fn.c ---*/ -#line 88 "./asn1/x2ap/packet-x2ap-template.c" +#line 90 "./asn1/x2ap/packet-x2ap-template.c" static int dissect_ProtocolIEFieldValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { @@ -7723,7 +7725,7 @@ void proto_register_x2ap(void) { "UnsuccessfulOutcome_value", HFILL }}, /*--- End of included file: packet-x2ap-hfarr.c ---*/ -#line 146 "./asn1/x2ap/packet-x2ap-template.c" +#line 148 "./asn1/x2ap/packet-x2ap-template.c" }; /* List of subtrees */ @@ -7893,7 +7895,7 @@ void proto_register_x2ap(void) { &ett_x2ap_UnsuccessfulOutcome, /*--- End of included file: packet-x2ap-ettarr.c ---*/ -#line 153 "./asn1/x2ap/packet-x2ap-template.c" +#line 155 "./asn1/x2ap/packet-x2ap-template.c" }; module_t *x2ap_module; @@ -7905,7 +7907,7 @@ void proto_register_x2ap(void) { proto_register_subtree_array(ett, array_length(ett)); /* Register dissector */ - register_dissector("x2ap", dissect_x2ap, proto_x2ap); + x2ap_handle = register_dissector("x2ap", dissect_x2ap, proto_x2ap); /* Register dissector tables */ x2ap_ies_dissector_table = register_dissector_table("x2ap.ies", "X2AP-PROTOCOL-IES", proto_x2ap, FT_UINT32, BASE_DEC, DISSECTOR_TABLE_ALLOW_DUPLICATE); @@ -7930,11 +7932,9 @@ void proto_register_x2ap(void) { void proto_reg_handoff_x2ap(void) { - dissector_handle_t x2ap_handle; static gboolean Initialized=FALSE; static guint SctpPort; - x2ap_handle = find_dissector("x2ap"); if (!Initialized) { dissector_add_for_decode_as("sctp.port", x2ap_handle); dissector_add_uint("sctp.ppi", X2AP_PAYLOAD_PROTOCOL_ID, x2ap_handle); -- cgit v1.2.3