aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/camel
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-06-27 15:33:42 -0700
committerMichael Mann <mmann78@netscape.net>2015-07-04 00:17:14 +0000
commit3243b6f964c96f0137fc3fffd66a74dd9f7910fd (patch)
treecb4c47ada88b45cd7f6b1835cd412d1d60b746c2 /asn1/camel
parent7b33634cc562ba0ee75536b7dde4268a20d89bee (diff)
asn1: split off cleanup routines
General approach: 1. Split allocation (e.g. g_hash_table_new) from deallocation (g_hash_table_destroy) into functions named "init" and "cleanup". 2. Remove guards that test whether the hash tables are set as init is always called before cleanup. 3. Remove setting hash tables to NULL after destruction. 4. Copy register_init_routine function call and change init to cleanup. 5. Add cleanup function that calls reassembly_table_destroy if there is a reassembly_table_init function. Some templates were modified as follows: - snmp: split renew into init+cleanup, but keep renew for the uat_new callback. - ldap,ros: Rename init to cleanup as there was no initialization. - camel: remove init function from header, make it static. Remove debug print. - tcap: remove unused ssn_range assignment. Files in epan/ were regenerated using cmake && make asn1 Change-Id: Idac16ebf0ec304e0c8becaab5d32904e56eb69b9 Reviewed-on: https://code.wireshark.org/review/9136 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'asn1/camel')
-rw-r--r--asn1/camel/packet-camel-template.c22
-rw-r--r--asn1/camel/packet-camel-template.h6
2 files changed, 9 insertions, 19 deletions
diff --git a/asn1/camel/packet-camel-template.c b/asn1/camel/packet-camel-template.c
index 2c11b5a219..f0f3e93f0f 100644
--- a/asn1/camel/packet-camel-template.c
+++ b/asn1/camel/packet-camel-template.c
@@ -496,23 +496,11 @@ new_camelsrt_call(struct camelsrt_call_info_key_t *p_camelsrt_call_key)
* Routine called when the TAP is initialized.
* so hash table are (re)created
*/
-void
+static void
camelsrt_init_routine(void)
{
-
- /* free hash-table for SRT */
- if (srt_calls != NULL) {
-#ifdef DEBUG_CAMELSRT
- dbg(16,"Destroy hash ");
-#endif
- g_hash_table_destroy(srt_calls);
- }
-
/* create new hash-table for SRT */
srt_calls = g_hash_table_new(camelsrt_call_hash, camelsrt_call_equal);
-#ifdef DEBUG_CAMELSRT
- dbg(16,"Create hash ");
-#endif
/* Reset the session counter */
camelsrt_global_SessionId=1;
@@ -523,6 +511,13 @@ camelsrt_init_routine(void)
gcamel_DisplaySRT=gcamel_PersistentSRT || gcamel_HandleSRT&gcamel_StatSRT;
}
+static void
+camelsrt_cleanup_routine(void)
+{
+ /* free hash-table for SRT */
+ g_hash_table_destroy(srt_calls);
+}
+
/*
* Update a record with the data of the Request
@@ -1510,6 +1505,7 @@ void proto_register_camel(void) {
/* Routine for statistic */
register_init_routine(&camelsrt_init_routine);
+ register_cleanup_routine(&camelsrt_cleanup_routine);
camel_tap=register_tap(PSNAME);
register_srt_table(proto_camel, "CAMEL", 1, camelstat_packet, camelstat_init, NULL);
diff --git a/asn1/camel/packet-camel-template.h b/asn1/camel/packet-camel-template.h
index d8a4eef3a7..f73e0d4220 100644
--- a/asn1/camel/packet-camel-template.h
+++ b/asn1/camel/packet-camel-template.h
@@ -119,12 +119,6 @@ struct camelsrt_info_t {
};
/**
- * Routine called when the TAP is initialized.
- * so hash table are (re)created
- */
-void camelsrt_init_routine(void);
-
-/**
* Initialize the Message Info used by the main dissector
* Data are linked to a TCAP transaction
*/