aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-sv.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-sv.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-sv.c')
-rw-r--r--epan/dissectors/packet-sv.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/epan/dissectors/packet-sv.c b/epan/dissectors/packet-sv.c
index 39b547d1fa..37e7da43b4 100644
--- a/epan/dissectors/packet-sv.c
+++ b/epan/dissectors/packet-sv.c
@@ -143,6 +143,8 @@ static expert_field ei_sv_zero_pdu = EI_INIT;
static gboolean sv_decode_data_as_phsmeas = FALSE;
+static dissector_handle_t sv_handle;
+
static const value_string sv_q_validity_vals[] = {
{ 0, "good" },
{ 1, "invalid" },
@@ -436,7 +438,7 @@ dissect_sv_SampledValues(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
/*--- End of included file: packet-sv-fn.c ---*/
-#line 185 "./asn1/sv/packet-sv-template.c"
+#line 187 "./asn1/sv/packet-sv-template.c"
/*
* Dissect SV PDUs inside a PPDU.
@@ -605,7 +607,7 @@ void proto_register_sv(void) {
NULL, HFILL }},
/*--- End of included file: packet-sv-hfarr.c ---*/
-#line 297 "./asn1/sv/packet-sv-template.c"
+#line 299 "./asn1/sv/packet-sv-template.c"
};
/* List of subtrees */
@@ -622,7 +624,7 @@ void proto_register_sv(void) {
&ett_sv_ASDU,
/*--- End of included file: packet-sv-ettarr.c ---*/
-#line 305 "./asn1/sv/packet-sv-template.c"
+#line 307 "./asn1/sv/packet-sv-template.c"
};
static ei_register_info ei[] = {
@@ -635,7 +637,7 @@ void proto_register_sv(void) {
/* Register protocol */
proto_sv = proto_register_protocol(PNAME, PSNAME, PFNAME);
- register_dissector("sv", dissect_sv, proto_sv);
+ sv_handle = register_dissector("sv", dissect_sv, proto_sv);
/* Register fields and subtrees */
proto_register_field_array(proto_sv, hf, array_length(hf));
@@ -653,9 +655,5 @@ void proto_register_sv(void) {
/*--- proto_reg_handoff_sv --- */
void proto_reg_handoff_sv(void) {
-
- dissector_handle_t sv_handle;
- sv_handle = find_dissector("sv");
-
dissector_add_uint("ethertype", ETHERTYPE_IEC61850_SV, sv_handle);
}