aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2017-09-27 22:03:43 +0200
committerAnders Broman <a.broman58@gmail.com>2017-10-04 03:48:12 +0000
commit0553cda6dab3f69ccd32adb6d60723e9baf56d4a (patch)
tree7e991692b0eb5ef9298d54d2b46edebaaa5a0b6a
parentf61c381b5a019b3fc8756fd5c199894886eb2492 (diff)
Instroduce col_finalize(), to allow creating column_info based not only on preferences.
Change-Id: I417e6accff3390a9b1839cd6b44266b76aa754c3 Reviewed-on: https://code.wireshark.org/review/23767 Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/column.c37
-rw-r--r--epan/column.h4
2 files changed, 30 insertions, 11 deletions
diff --git a/epan/column.c b/epan/column.c
index 6d4fa62..1851dbf 100644
--- a/epan/column.c
+++ b/epan/column.c
@@ -808,22 +808,15 @@ get_column_tooltip(const gint col)
}
void
-build_column_format_array(column_info *cinfo, const gint num_cols, const gboolean reset_fences)
+col_finalize(column_info *cinfo)
{
int i;
col_item_t* col_item;
- /* Build the column format array */
- col_setup(cinfo, num_cols);
-
for (i = 0; i < cinfo->num_cols; i++) {
col_item = &cinfo->columns[i];
- col_item->col_fmt = get_column_format(i);
- col_item->col_title = g_strdup(get_column_title(i));
if (col_item->col_fmt == COL_CUSTOM) {
- col_item->col_custom_fields = g_strdup(get_column_custom_fields(i));
- col_item->col_custom_occurrence = get_column_custom_occurrence(i);
if(!dfilter_compile(col_item->col_custom_fields, &col_item->col_custom_dfilter, NULL)) {
/* XXX: Should we issue a warning? */
g_free(col_item->col_custom_fields);
@@ -863,9 +856,6 @@ build_column_format_array(column_info *cinfo, const gint num_cols, const gboolea
else
col_item->col_buf = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_LEN);
- if(reset_fences)
- col_item->col_fence = 0;
-
cinfo->col_expr.col_expr[i] = "";
cinfo->col_expr.col_expr_val[i] = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_LEN);
}
@@ -888,6 +878,31 @@ build_column_format_array(column_info *cinfo, const gint num_cols, const gboolea
}
}
+void
+build_column_format_array(column_info *cinfo, const gint num_cols, const gboolean reset_fences)
+{
+ int i;
+ col_item_t* col_item;
+
+ /* Build the column format array */
+ col_setup(cinfo, num_cols);
+
+ for (i = 0; i < cinfo->num_cols; i++) {
+ col_item = &cinfo->columns[i];
+ col_item->col_fmt = get_column_format(i);
+ col_item->col_title = g_strdup(get_column_title(i));
+ if (col_item->col_fmt == COL_CUSTOM) {
+ col_item->col_custom_fields = g_strdup(get_column_custom_fields(i));
+ col_item->col_custom_occurrence = get_column_custom_occurrence(i);
+ }
+
+ if(reset_fences)
+ col_item->col_fence = 0;
+ }
+
+ col_finalize(cinfo);
+}
+
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
diff --git a/epan/column.h b/epan/column.h
index 365652e..04a219a 100644
--- a/epan/column.h
+++ b/epan/column.h
@@ -80,6 +80,10 @@ gchar *get_column_tooltip(const gint col);
WS_DLL_PUBLIC
void
+col_finalize(column_info *cinfo);
+
+WS_DLL_PUBLIC
+void
build_column_format_array(column_info *cinfo, const gint num_cols, const gboolean reset_fences);
WS_DLL_PUBLIC