aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ansi_map.c
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 /epan/dissectors/packet-ansi_map.c
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 'epan/dissectors/packet-ansi_map.c')
-rw-r--r--epan/dissectors/packet-ansi_map.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/epan/dissectors/packet-ansi_map.c b/epan/dissectors/packet-ansi_map.c
index 0dfb67e371..553bfe7d7f 100644
--- a/epan/dissectors/packet-ansi_map.c
+++ b/epan/dissectors/packet-ansi_map.c
@@ -1177,20 +1177,16 @@ static void dissect_ansi_map_win_trigger_list(tvbuff_t *tvb, packet_info *pinfo
static GHashTable *TransactionId_table=NULL;
static void
-ansi_map_init_transaction_table(void){
-
- /* Destroy any existing memory chunks / hashes. */
- if (TransactionId_table){
- g_hash_table_destroy(TransactionId_table);
- }
-
+ansi_map_init(void)
+{
TransactionId_table = g_hash_table_new(g_str_hash, g_str_equal);
}
static void
-ansi_map_init_protocol(void)
+ansi_map_cleanup(void)
{
- ansi_map_init_transaction_table();
+ /* Destroy any existing memory chunks / hashes. */
+ g_hash_table_destroy(TransactionId_table);
}
/* Store Invoke information needed for the corresponding reply */
@@ -15280,7 +15276,7 @@ dissect_ansi_map_QualificationRequest2Res(gboolean implicit_tag _U_, tvbuff_t *t
/*--- End of included file: packet-ansi_map-fn.c ---*/
-#line 3635 "../../asn1/ansi_map/packet-ansi_map-template.c"
+#line 3631 "../../asn1/ansi_map/packet-ansi_map-template.c"
/*
* 6.5.2.dk N.S0013-0 v 1.0,X.S0004-550-E v1.0 2.301
@@ -19228,7 +19224,7 @@ void proto_register_ansi_map(void) {
NULL, HFILL }},
/*--- End of included file: packet-ansi_map-hfarr.c ---*/
-#line 5390 "../../asn1/ansi_map/packet-ansi_map-template.c"
+#line 5386 "../../asn1/ansi_map/packet-ansi_map-template.c"
};
/* List of subtrees */
@@ -19489,7 +19485,7 @@ void proto_register_ansi_map(void) {
&ett_ansi_map_ReturnData,
/*--- End of included file: packet-ansi_map-ettarr.c ---*/
-#line 5423 "../../asn1/ansi_map/packet-ansi_map-template.c"
+#line 5419 "../../asn1/ansi_map/packet-ansi_map-template.c"
};
static ei_register_info ei[] = {
@@ -19562,6 +19558,7 @@ void proto_register_ansi_map(void) {
"Type of matching invoke/response, risk of missmatch if loose matching choosen",
&ansi_map_response_matching_type, ansi_map_response_matching_type_values, FALSE);
- register_init_routine(&ansi_map_init_protocol);
+ register_init_routine(&ansi_map_init);
+ register_cleanup_routine(&ansi_map_cleanup);
register_new_stat_tap_ui(&stat_table);
}