tshark/tfshark: Replace global prefs with a boolean

This partially reverts dc0e6ccc9f in favor
of a cleaner solution.

Change-Id: Ie57329020b5a7d15eb7d99aad3103843a14f07a6
Reviewed-on: https://code.wireshark.org/review/24278
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
This commit is contained in:
Orgad Shaneh 2017-11-08 13:50:33 +02:00 committed by Dario Lombardo
parent 2125275c7c
commit 8730b2037a
2 changed files with 10 additions and 5 deletions

View File

@ -107,6 +107,8 @@ static frame_data prev_dis_frame;
static frame_data *prev_cap;
static frame_data prev_cap_frame;
static gboolean prefs_loaded = FALSE;
static gboolean perform_two_pass_analysis;
/*
@ -157,7 +159,6 @@ static void failure_message_cont(const char *msg_format, va_list ap);
capture_file cfile;
static GHashTable *output_only_tables = NULL;
static e_prefs *prefs_p = NULL;
#if 0
struct string_elem {
@ -288,7 +289,7 @@ tfshark_log_handler (const gchar *log_domain, GLogLevelFlags log_level,
ERROR and CRITICAL level messages so the current code is a behavioral
change. The current behavior is the same as in Wireshark.
*/
if (prefs_p && (log_level & G_LOG_LEVEL_MASK & prefs.console_log_level) == 0) {
if (prefs_loaded && (log_level & G_LOG_LEVEL_MASK & prefs.console_log_level) == 0) {
return;
}
@ -345,6 +346,7 @@ main(int argc, char *argv[])
dfilter_t *rfcode = NULL;
dfilter_t *dfcode = NULL;
gchar *err_msg;
e_prefs *prefs_p;
int log_flags;
gchar *output_only = NULL;
@ -600,6 +602,7 @@ main(int argc, char *argv[])
/* Load libwireshark settings from the current profile. */
prefs_p = epan_load_settings();
prefs_loaded = TRUE;
cap_file_init(&cfile);

View File

@ -214,6 +214,8 @@ static proto_node_children_grouper_func node_children_grouper = proto_node_group
/* The line separator used between packets, changeable via the -S option */
static const char *separator = "";
static gboolean prefs_loaded = FALSE;
#ifdef HAVE_LIBPCAP
/*
* TRUE if we're to print packet counts to keep track of captured packets.
@ -224,8 +226,6 @@ static capture_options global_capture_opts;
static capture_session global_capture_session;
static info_data_t global_info_data;
static e_prefs *prefs_p = NULL;
#ifdef SIGINFO
static gboolean infodelay; /* if TRUE, don't print capture info in SIGINFO handler */
static gboolean infoprint; /* if TRUE, print capture info after clearing infodelay */
@ -526,7 +526,7 @@ tshark_log_handler (const gchar *log_domain, GLogLevelFlags log_level,
ERROR and CRITICAL level messages so the current code is a behavioral
change. The current behavior is the same as in Wireshark.
*/
if (prefs_p && (log_level & G_LOG_LEVEL_MASK & prefs.console_log_level) == 0) {
if (prefs_loaded && (log_level & G_LOG_LEVEL_MASK & prefs.console_log_level) == 0) {
return;
}
@ -718,6 +718,7 @@ main(int argc, char *argv[])
dfilter_t *rfcode = NULL;
dfilter_t *dfcode = NULL;
gchar *err_msg;
e_prefs *prefs_p;
int log_flags;
gchar *output_only = NULL;
gchar *volatile pdu_export_arg = NULL;
@ -1029,6 +1030,7 @@ main(int argc, char *argv[])
/* Load libwireshark settings from the current profile. */
prefs_p = epan_load_settings();
prefs_loaded = TRUE;
read_filter_list(CFILTER_LIST);