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>
This commit is contained in:
Jakub Zawadzki 2017-09-27 22:03:43 +02:00 committed by Anders Broman
parent f61c381b5a
commit 0553cda6da
2 changed files with 30 additions and 11 deletions

View File

@ -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
*

View File

@ -78,6 +78,10 @@ gint get_column_char_width(const gint format);
WS_DLL_PUBLIC
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);