aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-12-30 22:28:25 -0800
committerGuy Harris <guy@alum.mit.edu>2014-12-31 06:29:11 +0000
commit27be466c9b6ac1bdd62a5b86bf9c684ac55482ee (patch)
treeef81ff7dfb56101e3e1ce762c9a6a2c671c8d54d
parent84110d2981fbc017ef3771e8c051054b6546bc1f (diff)
Do the full string in get_{compiled,runtime}_version_info().
Have them start the string with "Compiled" or "Running on", and return the string when done. Change-Id: Ic4d290c963621fa0385dc5aab766fd4ad31d3810 Reviewed-on: https://code.wireshark.org/review/6155 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--capinfos.c10
-rw-r--r--captype.c10
-rw-r--r--dumpcap.c10
-rw-r--r--echld/dispatcher.c6
-rw-r--r--editcap.c10
-rw-r--r--mergecap.c10
-rw-r--r--rawshark.c10
-rw-r--r--reordercap.c10
-rw-r--r--text2pcap.c10
-rw-r--r--tfshark.c14
-rw-r--r--tshark.c14
-rw-r--r--ui/gtk/main.c13
-rw-r--r--ui/qt/main.cpp13
-rw-r--r--wsutil/ws_version_info.c40
-rw-r--r--wsutil/ws_version_info.h30
15 files changed, 102 insertions, 108 deletions
diff --git a/capinfos.c b/capinfos.c
index b5a2104847..9d4c2ebebe 100644
--- a/capinfos.c
+++ b/capinfos.c
@@ -1135,13 +1135,11 @@ main(int argc, char *argv[])
size_t hash_bytes;
#endif
- /* Assemble the compile-time version information string */
- comp_info_str = g_string_new("Compiled ");
- get_compiled_version_info(comp_info_str, NULL, get_capinfos_compiled_info);
+ /* Get the compile-time version information string */
+ comp_info_str = get_compiled_version_info(NULL, get_capinfos_compiled_info);
- /* Assemble the run-time version information string */
- runtime_info_str = g_string_new("Running ");
- get_runtime_version_info(runtime_info_str, get_capinfos_runtime_info);
+ /* Get the run-time version information string */
+ runtime_info_str = get_runtime_version_info(get_capinfos_runtime_info);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Capinfos (Wireshark) %s\n"
diff --git a/captype.c b/captype.c
index 0f52b044b3..bc09e2d777 100644
--- a/captype.c
+++ b/captype.c
@@ -139,13 +139,11 @@ main(int argc, char *argv[])
char *init_progfile_dir_error;
#endif
- /* Assemble the compile-time version information string */
- comp_info_str = g_string_new("Compiled ");
- get_compiled_version_info(comp_info_str, NULL, get_captype_compiled_info);
+ /* Get the compile-time version information string */
+ comp_info_str = get_compiled_version_info(NULL, get_captype_compiled_info);
- /* Assemble the run-time version information string */
- runtime_info_str = g_string_new("Running ");
- get_runtime_version_info(runtime_info_str, get_captype_runtime_info);
+ /* Get the run-time version information string */
+ runtime_info_str = get_runtime_version_info(get_captype_runtime_info);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Captype (Wireshark) %s\n"
diff --git a/dumpcap.c b/dumpcap.c
index 5e32a4d3a3..9aae11b54b 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -4249,13 +4249,11 @@ main(int argc, char *argv[])
cmdarg_err_init(dumpcap_cmdarg_err, dumpcap_cmdarg_err_cont);
- /* Assemble the compile-time version information string */
- comp_info_str = g_string_new("Compiled ");
- get_compiled_version_info(comp_info_str, NULL, get_dumpcap_compiled_info);
+ /* Get the compile-time version information string */
+ comp_info_str = get_compiled_version_info(NULL, get_dumpcap_compiled_info);
- /* Assemble the run-time version information string */
- runtime_info_str = g_string_new("Running ");
- get_runtime_version_info(runtime_info_str, get_dumpcap_runtime_info);
+ /* Get the run-time version information string */
+ runtime_info_str = get_runtime_version_info(get_dumpcap_runtime_info);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Dumpcap (Wireshark) %s\n"
diff --git a/echld/dispatcher.c b/echld/dispatcher.c
index 6788e27038..20e59753f6 100644
--- a/echld/dispatcher.c
+++ b/echld/dispatcher.c
@@ -482,11 +482,9 @@ static void preinit_epan(char* argv0, int (*main)(int, char **)) {
error = init_progfile_dir(argv0, main);
- comp_info_str = g_string_new("Compiled ");
- get_compiled_version_info(comp_info_str, NULL, epan_get_compiled_version_info);
+ comp_info_str = get_compiled_version_info(NULL, epan_get_compiled_version_info);
- runtime_info_str = g_string_new("Running ");
- get_runtime_version_info(runtime_info_str, NULL);
+ runtime_info_str = get_runtime_version_info(NULL);
version_long_str = g_strdup_printf("Echld %s\n%s\n%s\n%s",
get_ws_vcs_version_info(), get_copyright_info(),
diff --git a/editcap.c b/editcap.c
index db03cae82a..cd42dfbf21 100644
--- a/editcap.c
+++ b/editcap.c
@@ -922,13 +922,11 @@ main(int argc, char *argv[])
create_app_running_mutex();
#endif /* _WIN32 */
- /* Assemble the compile-time version information string */
- comp_info_str = g_string_new("Compiled ");
- get_compiled_version_info(comp_info_str, NULL, get_editcap_compiled_info);
+ /* Get the compile-time version information string */
+ comp_info_str = get_compiled_version_info(NULL, get_editcap_compiled_info);
- /* Assemble the run-time version information string */
- runtime_info_str = g_string_new("Running ");
- get_runtime_version_info(runtime_info_str, get_editcap_runtime_info);
+ /* Get the run-time version information string */
+ runtime_info_str = get_runtime_version_info(get_editcap_runtime_info);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Editcap (Wireshark) %s\n"
diff --git a/mergecap.c b/mergecap.c
index 7036c91851..a8f7daa4ef 100644
--- a/mergecap.c
+++ b/mergecap.c
@@ -249,13 +249,11 @@ main(int argc, char *argv[])
create_app_running_mutex();
#endif /* _WIN32 */
- /* Assemble the compile-time version information string */
- comp_info_str = g_string_new("Compiled ");
- get_compiled_version_info(comp_info_str, NULL, get_mergecap_compiled_info);
+ /* Get the compile-time version information string */
+ comp_info_str = get_compiled_version_info(NULL, get_mergecap_compiled_info);
- /* Assemble the run-time version information string */
- runtime_info_str = g_string_new("Running ");
- get_runtime_version_info(runtime_info_str, get_mergecap_runtime_info);
+ /* Get the run-time version information string */
+ runtime_info_str = get_runtime_version_info(get_mergecap_runtime_info);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Mergecap (Wireshark) %s\n"
diff --git a/rawshark.c b/rawshark.c
index 5b6363f881..00c805defe 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -454,13 +454,11 @@ main(int argc, char *argv[])
cmdarg_err_init(rawshark_cmdarg_err, rawshark_cmdarg_err_cont);
- /* Assemble the compile-time version information string */
- comp_info_str = g_string_new("Compiled ");
- get_compiled_version_info(comp_info_str, NULL, epan_get_compiled_version_info);
+ /* Get the compile-time version information string */
+ comp_info_str = get_compiled_version_info(NULL, epan_get_compiled_version_info);
- /* Assemble the run-time version information string */
- runtime_info_str = g_string_new("Running ");
- get_runtime_version_info(runtime_info_str, NULL);
+ /* Get the run-time version information string */
+ runtime_info_str = get_runtime_version_info(NULL);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Rawshark (Wireshark) %s\n"
diff --git a/reordercap.c b/reordercap.c
index 9f7e459251..1dcac3d4a6 100644
--- a/reordercap.c
+++ b/reordercap.c
@@ -206,13 +206,11 @@ main(int argc, char *argv[])
char *infile;
char *outfile;
- /* Assemble the compile-time version information string */
- comp_info_str = g_string_new("Compiled ");
- get_compiled_version_info(comp_info_str, NULL, get_reordercap_compiled_info);
+ /* Get the compile-time version information string */
+ comp_info_str = get_compiled_version_info(NULL, get_reordercap_compiled_info);
- /* Assemble the run-time version information string */
- runtime_info_str = g_string_new("Running ");
- get_runtime_version_info(runtime_info_str, get_reordercap_runtime_info);
+ /* Get the run-time version information string */
+ runtime_info_str = get_runtime_version_info(get_reordercap_runtime_info);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Reordercap (Wireshark) %s\n"
diff --git a/text2pcap.c b/text2pcap.c
index fae7b14532..5da91378c8 100644
--- a/text2pcap.c
+++ b/text2pcap.c
@@ -1546,13 +1546,11 @@ parse_options (int argc, char *argv[])
create_app_running_mutex();
#endif /* _WIN32 */
- /* Assemble the compile-time version information string */
- comp_info_str = g_string_new("Compiled ");
- get_compiled_version_info(comp_info_str, NULL, get_text2pcap_compiled_info);
+ /* Get the compile-time version information string */
+ comp_info_str = get_compiled_version_info(NULL, get_text2pcap_compiled_info);
- /* Assemble the run-time version information string */
- runtime_info_str = g_string_new("Running ");
- get_runtime_version_info(runtime_info_str, get_text2pcap_runtime_info);
+ /* get the run-time version information string */
+ runtime_info_str = get_runtime_version_info(get_text2pcap_runtime_info);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Text2pcap (Wireshark) %s\n"
diff --git a/tfshark.c b/tfshark.c
index 0d9b000dbe..5f23676e52 100644
--- a/tfshark.c
+++ b/tfshark.c
@@ -846,14 +846,12 @@ main(int argc, char *argv[])
initialize_funnel_ops();
- /* Assemble the compile-time version information string */
- comp_info_str = g_string_new("Compiled ");
- get_compiled_version_info(comp_info_str, get_tfshark_compiled_version_info,
- epan_get_compiled_version_info);
-
- /* Assemble the run-time version information string */
- runtime_info_str = g_string_new("Running ");
- get_runtime_version_info(runtime_info_str, get_tfshark_runtime_version_info);
+ /* Get the compile-time version information string */
+ comp_info_str = get_compiled_version_info(get_tfshark_compiled_version_info,
+ epan_get_compiled_version_info);
+
+ /* Get the run-time version information string */
+ runtime_info_str = get_runtime_version_info(tfshark_runtime_version_info);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("TFShark (Wireshark) %s\n"
diff --git a/tshark.c b/tshark.c
index c928ec0ef3..934c731dfe 100644
--- a/tshark.c
+++ b/tshark.c
@@ -1055,14 +1055,12 @@ main(int argc, char *argv[])
}
#endif
- /* Assemble the compile-time version information string */
- comp_info_str = g_string_new("Compiled ");
- get_compiled_version_info(comp_info_str, get_tshark_compiled_version_info,
- epan_get_compiled_version_info);
-
- /* Assemble the run-time version information string */
- runtime_info_str = g_string_new("Running ");
- get_runtime_version_info(runtime_info_str, get_tshark_runtime_version_info);
+ /* Get the compile-time version information string */
+ comp_info_str = get_compiled_version_info(get_tshark_compiled_version_info,
+ epan_get_compiled_version_info);
+
+ /* Get the run-time version information string */
+ runtime_info_str = get_runtime_version_info(get_tshark_runtime_version_info);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("TShark (Wireshark) %s\n"
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index 1a3632adde..930c8d668d 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -2257,15 +2257,12 @@ main(int argc, char *argv[])
#endif /* HAVE_AIRPCAP */
#endif /* _WIN32 */
- /* Assemble the compile-time version information string */
- comp_info_str = g_string_new("Compiled ");
+ /* Get the compile-time version information string */
+ comp_info_str = get_compiled_version_info(get_wireshark_gtk_compiled_info,
+ get_gui_compiled_info);
- get_compiled_version_info(comp_info_str, get_wireshark_gtk_compiled_info,
- get_gui_compiled_info);
-
- /* Assemble the run-time version information string */
- runtime_info_str = g_string_new("Running ");
- get_runtime_version_info(runtime_info_str, get_wireshark_runtime_info);
+ /* Get the run-time version information string */
+ runtime_info_str = get_runtime_version_info(get_wireshark_runtime_info);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Wireshark %s\n"
diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp
index 4449a0aa98..8a05d8cc49 100644
--- a/ui/qt/main.cpp
+++ b/ui/qt/main.cpp
@@ -571,17 +571,14 @@ int main(int argc, char *argv[])
};
static const char optstring[] = OPTSTRING;
- /* Assemble the compile-time version information string */
- comp_info_str = g_string_new("Compiled ");
-
- // xxx qtshark
- get_compiled_version_info(comp_info_str, get_wireshark_qt_compiled_info,
- get_gui_compiled_info);
+ /* Get the compile-time version information string */
+ // XXX qtshark
+ comp_info_str = get_compiled_version_info(get_wireshark_qt_compiled_info,
+ get_gui_compiled_info);
/* Assemble the run-time version information string */
- runtime_info_str = g_string_new("Running ");
// xxx qtshark
- get_runtime_version_info(runtime_info_str, get_wireshark_runtime_info);
+ runtime_info_str = get_runtime_version_info(get_wireshark_runtime_info);
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Wireshark %s\n"
diff --git a/wsutil/ws_version_info.c b/wsutil/ws_version_info.c
index c0e83ae467..d190e10e58 100644
--- a/wsutil/ws_version_info.c
+++ b/wsutil/ws_version_info.c
@@ -68,18 +68,26 @@ end_string(GString *str)
}
/*
- * Get various library compile-time versions and append them to
- * the specified GString.
+ * Get various library compile-time versions, put them in a GString,
+ * and return the GString.
*
- * "additional_info" is called at the end to append any additional
- * information; this is required in order to, for example, put the
- * Portaudio information at the end of the string, as we currently
- * don't use Portaudio in TShark.
+ * "prepend_info" is called at the start to prepend any additional
+ * information before the standard library information.
+ *
+ * "append_info" is called at the end to append any additional
+ * information after the standard library information. This is
+ * required in order to, for example, put the Portaudio information
+ * at the end of the string, as we currently don't use Portaudio in
+ * TShark.
*/
-void
-get_compiled_version_info(GString *str, void (*prepend_info)(GString *),
+GString *
+get_compiled_version_info(void (*prepend_info)(GString *),
void (*append_info)(GString *))
{
+ GString *str;
+
+ str = g_string_new("Compiled ");
+
if (sizeof(str) == 4)
g_string_append(str, "(32-bit) ");
else
@@ -98,20 +106,28 @@ get_compiled_version_info(GString *str, void (*prepend_info)(GString *),
g_string_append(str, ".");
end_string(str);
+
+ return str;
}
/*
* Get various library run-time versions, and the OS version, and append
* them to the specified GString.
+ *
+ * "additional_info" is called at the end to append any additional
+ * information; this is required in order to, for example, put the
+ * Portaudio information at the end of the string, as we currently
+ * don't use Portaudio in TShark.
*/
-void
-get_runtime_version_info(GString *str, void (*additional_info)(GString *))
+GString *
+get_runtime_version_info(void (*additional_info)(GString *))
{
+ GString *str;
#ifndef _WIN32
gchar *lang;
#endif
- g_string_append(str, "on ");
+ str = g_string_new("Running on ");
get_os_version_info(str);
@@ -139,6 +155,8 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *))
get_compiler_info(str);
end_string(str);
+
+ return str;
}
void
diff --git a/wsutil/ws_version_info.h b/wsutil/ws_version_info.h
index 03f57fc92d..b2cf6b3b6c 100644
--- a/wsutil/ws_version_info.h
+++ b/wsutil/ws_version_info.h
@@ -31,27 +31,31 @@ extern "C" {
#endif /* __cplusplus */
/*
- * Get various library compile-time versions and append them to
- * the specified GString.
+ * Get various library compile-time versions, put them in a GString,
+ * and return the GString.
*
* "prepend_info" is called at the start to prepend any additional
- * information.
+ * information before the standard library information.
*
* "append_info" is called at the end to append any additional
- * information; this is required in order to, for example, put the
- * Portaudio information at the end of the string, as we currently
- * don't use Portaudio in TShark.
+ * information after the standard library information. This is
+ * required in order to, for example, put the Portaudio information
+ * at the end of the string, as we currently don't use Portaudio in
+ * TShark.
*/
-WS_DLL_PUBLIC void get_compiled_version_info(GString *str,
- void (*prepend_info)(GString *),
- void (*append_info)(GString *));
+WS_DLL_PUBLIC GString *get_compiled_version_info(void (*prepend_info)(GString *),
+ void (*append_info)(GString *));
/*
- * Get various library run-time versions, and the OS version, and append
- * them to the specified GString.
+ * Get various library run-time versions, and the OS version, put them in
+ * a GString, and return the GString.
+ *
+ * "additional_info" is called at the end to append any additional
+ * information; this is required in order to, for example, put the
+ * Portaudio information at the end of the string, as we currently
+ * don't use Portaudio in TShark.
*/
-WS_DLL_PUBLIC void get_runtime_version_info(GString *str,
- void (*additional_info)(GString *));
+WS_DLL_PUBLIC GString *get_runtime_version_info(void (*additional_info)(GString *));
WS_DLL_PUBLIC void show_version(const gchar *prog_name, GString *comp_info_str, GString *runtime_info_str);