From 21a3b8cc71ac127e21375c62e0a738db8f3ea286 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sat, 7 Jan 2017 08:52:23 -0500 Subject: Internalize struct preference Move "struct preference" into prefs.c, essentially creating a "private" structure to handle preferences. The 2 motivating factors were: 1. Better memory management so that clients/users of API don't have to worry about it. 2. Hide the ugliness of the union stuff and make it transparent to the API. A few bugs related to preference <-> Decode As integration were fixed while in the neighborhood. Change-Id: I509b9a236235d066b139c98222b701475e0ed365 Reviewed-on: https://code.wireshark.org/review/19578 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- ui/qt/sctp_chunk_statistics_dialog.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'ui/qt/sctp_chunk_statistics_dialog.cpp') diff --git a/ui/qt/sctp_chunk_statistics_dialog.cpp b/ui/qt/sctp_chunk_statistics_dialog.cpp index c75379d7d3..da13805850 100644 --- a/ui/qt/sctp_chunk_statistics_dialog.cpp +++ b/ui/qt/sctp_chunk_statistics_dialog.cpp @@ -98,7 +98,7 @@ void SCTPChunkStatisticsDialog::fillTable(bool all) FILE* fp = NULL; pref_t *pref = prefs_find_preference(prefs_find_module("sctp"),"statistics_chunk_types"); - uat_t *uat = pref->varp.uat; + uat_t *uat = prefs_get_uat_value(pref); gchar* fname = uat_get_actual_filename(uat,TRUE); bool init = false; @@ -212,7 +212,7 @@ void SCTPChunkStatisticsDialog::on_pushButton_clicked() pref_t *pref = prefs_find_preference(prefs_find_module("sctp"),"statistics_chunk_types"); - uat_t *uat = pref->varp.uat; + uat_t *uat = prefs_get_uat_value(pref); gchar* fname = uat_get_actual_filename(uat,TRUE); @@ -284,16 +284,16 @@ void SCTPChunkStatisticsDialog::on_actionChunkTypePreferences_triggered() gchar* err = NULL; pref_t *pref = prefs_find_preference(prefs_find_module("sctp"),"statistics_chunk_types"); - uat_t *uat = pref->varp.uat; + uat_t *uat = prefs_get_uat_value(pref); uat_clear(uat); - if (!uat_load(pref->varp.uat, &err)) { + if (!uat_load(uat, &err)) { /* XXX - report this through the GUI */ - printf("Error loading table '%s': %s",pref->varp.uat->name,err); + printf("Error loading table '%s': %s", uat->name,err); g_free(err); } - UatDialog *uatdialog = new UatDialog(this, pref->varp.uat); + UatDialog *uatdialog = new UatDialog(this, uat); uatdialog->exec(); // Emitting PacketDissectionChanged directly from a QDialog can cause // problems on OS X. -- cgit v1.2.1