Get rid of some GTK+-only stuff.

Change-Id: I6c14429d4d473464ad7bea18dee07c3adf34664d
Reviewed-on: https://code.wireshark.org/review/27479
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2018-05-12 16:00:36 -07:00
parent 4e0de38081
commit fb877ef5da
6 changed files with 10 additions and 26 deletions

View File

@ -82,7 +82,7 @@ register_rtd_table(const int proto_id, const char* tap_listener, guint num_table
wmem_tree_insert_string(registered_rtd_tables, proto_get_protocol_filter_name(proto_id), table, 0);
}
void free_rtd_table(rtd_stat_table* table, rtd_gui_free_cb gui_callback, void *callback_data)
void free_rtd_table(rtd_stat_table* table)
{
guint i;
@ -93,23 +93,14 @@ void free_rtd_table(rtd_stat_table* table, rtd_gui_free_cb gui_callback, void *c
g_free(table->time_stats);
table->time_stats = NULL;
table->num_rtds = 0;
/* Give GUI the first crack at it before we clean up */
if (gui_callback)
gui_callback(table, callback_data);
}
void reset_rtd_table(rtd_stat_table* table, rtd_gui_reset_cb gui_callback, void *callback_data)
void reset_rtd_table(rtd_stat_table* table)
{
guint i = 0;
for (i = 0; i < table->num_rtds; i++)
memset(table->time_stats[i].rtd, 0, sizeof(timestat_t)*table->time_stats[i].num_timestat);
/* Give GUI the first crack at it before we clean up */
if (gui_callback)
gui_callback(table, callback_data);
}
register_rtd_t* get_rtd_table_by_name(const char* name)

View File

@ -49,9 +49,6 @@ struct register_rtd;
typedef struct register_rtd register_rtd_t;
typedef void (*rtd_gui_init_cb)(rtd_stat_table* rtd, void* gui_data);
typedef void (*rtd_gui_reset_cb)(rtd_stat_table* rtd, void* gui_data); /* GTK+ only. */
typedef void (*rtd_gui_free_cb)(rtd_stat_table* rtd, void* gui_data); /* GTK+ only. */
typedef void (*rtd_init_cb)(struct register_rtd* rtd, rtd_gui_init_cb gui_callback, void* gui_data); /* GTK+ only. */
typedef void (*rtd_filter_check_cb)(const char *opt_arg, const char **filter, char** err);
/** Register the response time delay table.
@ -112,18 +109,14 @@ WS_DLL_PUBLIC register_rtd_t* get_rtd_table_by_name(const char* name);
/** Free the RTD table data.
*
* @param table RTD stat table array
* @param gui_callback optional callback from GUI
* @param callback_data callback data needed for GUI
*/
WS_DLL_PUBLIC void free_rtd_table(rtd_stat_table* table, rtd_gui_free_cb gui_callback, void *callback_data);
WS_DLL_PUBLIC void free_rtd_table(rtd_stat_table* table);
/** Reset table data in the RTD.
*
* @param table RTD table
* @param gui_callback optional callback from GUI
* @param callback_data callback data needed for GUI
*/
WS_DLL_PUBLIC void reset_rtd_table(rtd_stat_table* table, rtd_gui_reset_cb gui_callback, void *callback_data);
WS_DLL_PUBLIC void reset_rtd_table(rtd_stat_table* table);
/** Interator to walk RTD tables and execute func
* Used for initialization

View File

@ -1857,7 +1857,7 @@ sharkd_session_free_tap_rtd_cb(void *arg)
{
rtd_data_t *rtd_data = (rtd_data_t *) arg;
free_rtd_table(&rtd_data->stat_table, NULL, NULL);
free_rtd_table(&rtd_data->stat_table);
g_free(rtd_data);
}

View File

@ -103,7 +103,7 @@ init_rtd_tables(register_rtd_t* rtd, const char *filter)
error_string = register_tap_listener(get_rtd_tap_listener_name(rtd), &ui->rtd, filter, 0, NULL, get_rtd_packet_func(rtd), rtd_draw);
if (error_string) {
free_rtd_table(&ui->rtd.stat_table, NULL, NULL);
free_rtd_table(&ui->rtd.stat_table);
fprintf(stderr, "tshark: Couldn't register srt tap: %s\n", error_string->str);
g_string_free(error_string, TRUE);
exit(1);

View File

@ -103,7 +103,7 @@ init_stat_table(stat_tap_table_ui *stat_tap, const char *filter)
error_string = register_tap_listener(stat_tap->tap_name, &ui->stats, filter, 0, NULL, stat_tap->packet_func, simple_draw);
if (error_string) {
/* free_rtd_table(&ui->rtd.stat_table, NULL, NULL); */
/* free_rtd_table(&ui->rtd.stat_table); */
fprintf(stderr, "tshark: Couldn't register tap: %s\n", error_string->str);
g_string_free(error_string, TRUE);
exit(1);

View File

@ -201,7 +201,7 @@ void ResponseTimeDelayDialog::tapReset(void *rtdd_ptr)
ResponseTimeDelayDialog *rtd_dlg = static_cast<ResponseTimeDelayDialog *>(rtdd->user_data);
if (!rtd_dlg) return;
reset_rtd_table(&rtdd->stat_table, NULL, NULL);
reset_rtd_table(&rtdd->stat_table);
rtd_dlg->statsTreeWidget()->clear();
rtd_dlg->addRtdTable(&rtdd->stat_table);
}
@ -241,7 +241,7 @@ void ResponseTimeDelayDialog::fillTree()
tapReset,
get_rtd_packet_func(rtd_),
tapDraw)) {
free_rtd_table(&rtd_data.stat_table, NULL, NULL);
free_rtd_table(&rtd_data.stat_table);
reject(); // XXX Stay open instead?
return;
}
@ -256,7 +256,7 @@ void ResponseTimeDelayDialog::fillTree()
statsTreeWidget()->setSortingEnabled(true);
removeTapListeners();
free_rtd_table(&rtd_data.stat_table, NULL, NULL);
free_rtd_table(&rtd_data.stat_table);
}
QList<QVariant> ResponseTimeDelayDialog::treeItemData(QTreeWidgetItem *ti) const