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-disp.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'epan/dissectors/packet-disp.c') diff --git a/epan/dissectors/packet-disp.c b/epan/dissectors/packet-disp.c index 7102b54d1e..b4ab8d631e 100644 --- a/epan/dissectors/packet-disp.c +++ b/epan/dissectors/packet-disp.c @@ -252,6 +252,8 @@ static expert_field ei_disp_unsupported_errcode = EI_INIT; static expert_field ei_disp_unsupported_pdu = EI_INIT; static expert_field ei_disp_zero_pdu = EI_INIT; +static dissector_handle_t disp_handle = NULL; + /*--- Included file: packet-disp-fn.c ---*/ #line 1 "./asn1/disp/packet-disp-fn.c" @@ -1482,7 +1484,7 @@ static int dissect_ShadowingAgreementInfo_PDU(tvbuff_t *tvb _U_, packet_info *pi /*--- End of included file: packet-disp-fn.c ---*/ -#line 77 "./asn1/disp/packet-disp-template.c" +#line 79 "./asn1/disp/packet-disp-template.c" /* * Dissect DISP PDUs inside a ROS PDUs @@ -2040,7 +2042,7 @@ void proto_register_disp(void) { "ShadowErrorData", HFILL }}, /*--- End of included file: packet-disp-hfarr.c ---*/ -#line 202 "./asn1/disp/packet-disp-template.c" +#line 204 "./asn1/disp/packet-disp-template.c" }; /* List of subtrees */ @@ -2105,7 +2107,7 @@ void proto_register_disp(void) { &ett_disp_T_signedShadowError, /*--- End of included file: packet-disp-ettarr.c ---*/ -#line 208 "./asn1/disp/packet-disp-template.c" +#line 210 "./asn1/disp/packet-disp-template.c" }; static ei_register_info ei[] = { @@ -2120,7 +2122,7 @@ void proto_register_disp(void) { /* Register protocol */ proto_disp = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("disp", dissect_disp, proto_disp); + disp_handle = register_dissector("disp", dissect_disp, proto_disp); /* Register fields and subtrees */ proto_register_field_array(proto_disp, hf, array_length(hf)); @@ -2142,8 +2144,6 @@ void proto_register_disp(void) { /*--- proto_reg_handoff_disp --- */ void proto_reg_handoff_disp(void) { - dissector_handle_t disp_handle; - /*--- Included file: packet-disp-dis-tab.c ---*/ #line 1 "./asn1/disp/packet-disp-dis-tab.c" @@ -2165,9 +2165,6 @@ void proto_reg_handoff_disp(void) { oid_add_from_string("id-ac-reliable-shadow-supplier-initiated","2.5.3.7"); /* ABSTRACT SYNTAXES */ - - disp_handle = find_dissector("disp"); - register_ros_oid_dissector_handle("2.5.9.3", disp_handle, 0, "id-as-directory-shadow", FALSE); register_rtse_oid_dissector_handle("2.5.9.5", disp_handle, 0, "id-as-directory-reliable-shadow", FALSE); register_rtse_oid_dissector_handle("2.5.9.6", disp_handle, 0, "id-as-directory-reliable-binding", FALSE); -- cgit v1.2.3