summaryrefslogtreecommitdiff
path: root/ui/gtk/packet_list_store.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-09-01 08:28:34 -0700
committerGerald Combs <gerald@wireshark.org>2015-09-03 18:51:50 +0000
commit759e6187476da599e7afb5e2789b083d93786eed (patch)
tree80c9e5fda2e735c2afe7ae75909284602e544584 /ui/gtk/packet_list_store.c
parent0818347d1b4a7c99c527be81973cb60989f491f1 (diff)
downloadwireshark-759e6187476da599e7afb5e2789b083d93786eed.tar.gz
GTK packet list string chunk fixups.
Call g_string_chunk_clear when we clear the packet list. Allocate 1 MiB chunks instead of 32 byte chunks. This doesn't do much in practice locally but appears more correct according to the GStringChunk documentation and source code. Change-Id: I143b6e1b48d376ba826cb342ade71085a2d82d96 Reviewed-on: https://code.wireshark.org/review/10344 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/gtk/packet_list_store.c')
-rw-r--r--ui/gtk/packet_list_store.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ui/gtk/packet_list_store.c b/ui/gtk/packet_list_store.c
index 2774450ae9..75d1575d6a 100644
--- a/ui/gtk/packet_list_store.c
+++ b/ui/gtk/packet_list_store.c
@@ -586,6 +586,8 @@ packet_list_store_clear(PacketList *packet_list)
/* Generate new number */
packet_list->stamp = g_random_int();
+ g_string_chunk_clear(packet_list->string_pool);
+
#ifdef PACKET_LIST_STATISTICS
g_warning("Const strings: %u", packet_list->const_strings);
packet_list->const_strings = 0;
@@ -646,6 +648,7 @@ packet_list_append_record(PacketList *packet_list, frame_data *fdata)
return newrecord->visible_pos;
}
+#define PACKET_STRING_CHUNK_SIZE (1 * 1024 * 1024)
static void
packet_list_change_record(PacketList *packet_list, PacketListRecord *record, gint col, column_info *cinfo)
{
@@ -719,7 +722,7 @@ packet_list_change_record(PacketList *packet_list, PacketListRecord *record, gin
}
if(!packet_list->string_pool)
- packet_list->string_pool = g_string_chunk_new(32);
+ packet_list->string_pool = g_string_chunk_new(PACKET_STRING_CHUNK_SIZE);
if (!get_column_resolved (col) && cinfo->col_expr.col_expr_val[col]) {
/* Use the unresolved value in col_expr_val */
str = g_string_chunk_insert_const (packet_list->string_pool, (const gchar *)cinfo->col_expr.col_expr_val[col]);