aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-goose.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-06-30 20:41:45 -0400
committerAnders Broman <a.broman58@gmail.com>2016-07-01 14:26:20 +0000
commita062c802364fd83d43f934560149f2ddd1fee6a3 (patch)
treee5c9240b24a5b86c12b4a9481a2bd93e18b828f5 /epan/dissectors/packet-goose.c
parentd4add25cb77773d9564dfc8f340ab5ce491a7d20 (diff)
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 <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-goose.c')
-rw-r--r--epan/dissectors/packet-goose.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/epan/dissectors/packet-goose.c b/epan/dissectors/packet-goose.c
index f081e144d3..c23e0468b2 100644
--- a/epan/dissectors/packet-goose.c
+++ b/epan/dissectors/packet-goose.c
@@ -706,6 +706,8 @@ dissect_goose_GOOSEpdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
/*--- End of included file: packet-goose-fn.c ---*/
#line 59 "./asn1/goose/packet-goose-template.c"
+static dissector_handle_t goose_handle = NULL;
+
/*
* Dissect GOOSE PDUs inside a PPDU.
*/
@@ -1013,7 +1015,7 @@ void proto_register_goose(void) {
"UtcTime", HFILL }},
/*--- End of included file: packet-goose-hfarr.c ---*/
-#line 127 "./asn1/goose/packet-goose-template.c"
+#line 129 "./asn1/goose/packet-goose-template.c"
};
/* List of subtrees */
@@ -1041,7 +1043,7 @@ void proto_register_goose(void) {
&ett_goose_Data,
/*--- End of included file: packet-goose-ettarr.c ---*/
-#line 133 "./asn1/goose/packet-goose-template.c"
+#line 135 "./asn1/goose/packet-goose-template.c"
};
static ei_register_info ei[] = {
@@ -1053,7 +1055,7 @@ void proto_register_goose(void) {
/* Register protocol */
proto_goose = proto_register_protocol(PNAME, PSNAME, PFNAME);
- register_dissector("goose", dissect_goose, proto_goose);
+ goose_handle = register_dissector("goose", dissect_goose, proto_goose);
/* Register fields and subtrees */
proto_register_field_array(proto_goose, hf, array_length(hf));
@@ -1065,8 +1067,5 @@ void proto_register_goose(void) {
/*--- proto_reg_handoff_goose --- */
void proto_reg_handoff_goose(void) {
- dissector_handle_t goose_handle;
- goose_handle = find_dissector("goose");
-
dissector_add_uint("ethertype", ETHERTYPE_IEC61850_GOOSE, goose_handle);
}