From 84f905786ed2b2aabaec9a0c1045daeda66358ba Mon Sep 17 00:00:00 2001 From: AndersBroman Date: Mon, 11 Dec 2017 13:10:30 +0100 Subject: [capture_info] Fold the code of capture_info_open() into ui/capture.c Change-Id: Id302e88bed4da8b9b457049fb78b0bc7d7ffabe3 Reviewed-on: https://code.wireshark.org/review/24766 Petri-Dish: Anders Broman Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- capture_info.c | 18 ------------------ capture_info.h | 2 -- ui/capture.c | 14 +++++++++++++- ui/capture.h | 3 +++ 4 files changed, 16 insertions(+), 21 deletions(-) diff --git a/capture_info.c b/capture_info.c index 2c71e2ff64..b08f696d1a 100644 --- a/capture_info.c +++ b/capture_info.c @@ -23,24 +23,6 @@ #include -/* open the info */ -void capture_info_open(capture_session *cap_session, info_data_t* cap_info) -{ - if (cap_info->counts.counts_hash != NULL) - { - /* Clean up any previous lists of packet counts */ - g_hash_table_destroy(cap_info->counts.counts_hash); - } - cap_info->counts.counts_hash = g_hash_table_new_full( g_direct_hash, g_direct_equal, NULL, g_free ); - cap_info->counts.other = 0; - cap_info->counts.total = 0; - - cap_info->wtap = NULL; - cap_info->ui.counts = &cap_info->counts; - - capture_info_ui_create(&cap_info->ui, cap_session); -} - static const char * cf_open_error_message(int err, gchar *err_info, gboolean for_writing, diff --git a/capture_info.h b/capture_info.h index 9a5cdd5b53..aa5953595c 100644 --- a/capture_info.h +++ b/capture_info.h @@ -49,8 +49,6 @@ typedef struct _info_data { capture_info ui; /* user interface data */ } info_data_t; -/* open the info - init values (wtap, counts), create dialog */ -extern void capture_info_open(capture_session *cap_session, info_data_t* cap_info); /* new file arrived - (eventually close old wtap), open wtap */ extern gboolean capture_info_new_file(const char *new_filename, info_data_t* cap_info); diff --git a/ui/capture.c b/ui/capture.c index 68e667d8f8..4ec0da4c37 100644 --- a/ui/capture.c +++ b/ui/capture.c @@ -144,7 +144,19 @@ capture_start(capture_options *capture_opts, capture_session *cap_session, info_ capture_callback_invoke(capture_cb_capture_prepared, cap_session); if(capture_opts->show_info) - capture_info_open(cap_session, cap_data); + if (cap_data->counts.counts_hash != NULL) + { + /* Clean up any previous lists of packet counts */ + g_hash_table_destroy(cap_data->counts.counts_hash); + } + cap_data->counts.counts_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); + cap_data->counts.other = 0; + cap_data->counts.total = 0; + + cap_data->wtap = NULL; + cap_data->ui.counts = &cap_data->counts; + + capture_info_ui_create(&cap_data->ui, cap_session); } return ret; diff --git a/ui/capture.h b/ui/capture.h index 1f0082f816..219767c40f 100644 --- a/ui/capture.h +++ b/ui/capture.h @@ -91,6 +91,9 @@ extern gboolean capture_stats(if_stat_cache_t *sc, char *ifname, struct pcap_sta */ void capture_stat_stop(if_stat_cache_t *sc); +/* open the info - init values (wtap, counts), create dialog */ +extern void capture_info_open(capture_session *cap_session, info_data_t* cap_info); + #ifdef __cplusplus } #endif /* __cplusplus */ -- cgit v1.2.3