aboutsummaryrefslogtreecommitdiffstats
path: root/proto.c
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>1999-08-26 07:01:44 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>1999-08-26 07:01:44 +0000
commit8b2e03eea6229b300b3de3322f14c446d0c303e9 (patch)
tree67b0e784b1fe92f69ccda200009be6c647ab1028 /proto.c
parentae356ef145c26c64b1fd5594d8159376c963e6a0 (diff)
Introduces a new global gboolean variable: proto_tree_is_visible.
This is set before calling dissect_packet() to let the proto_tree routines whether or not it needs to go through the trouble of formatting strings. The use of this dramatically decreases the number of calls to vsnprintf. svn path=/trunk/; revision=583
Diffstat (limited to 'proto.c')
-rw-r--r--proto.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/proto.c b/proto.c
index 319c428d9a..931cccd763 100644
--- a/proto.c
+++ b/proto.c
@@ -1,7 +1,7 @@
/* proto.c
* Routines for protocol tree
*
- * $Id: proto.c,v 1.17 1999/08/26 06:20:50 gram Exp $
+ * $Id: proto.c,v 1.18 1999/08/26 07:01:43 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -83,8 +83,6 @@ static gboolean proto_check_id(GNode *node, gpointer data);
static int proto_register_field_init(header_field_info *hfinfo, int parent);
-void dfilter_yacc_init(void);
-
/* centralization of registration functions */
void proto_register_aarp(void);
void proto_register_arp(void);
@@ -155,6 +153,11 @@ GMemChunk *gmc_item_labels = NULL;
/* List which stores protocols and fields that have been registered */
GPtrArray *gpa_hfinfo = NULL;
+/* Is the parsing being done for a visible proto_tree or an invisible one?
+ * By setting this correctly, the proto_tree creation is sped up by not
+ * having to call vsnprintf and copy strings around.
+ */
+gboolean proto_tree_is_visible = TRUE;
/* initialize data structures and register protocols and fields */
void
@@ -353,7 +356,10 @@ proto_tree_add_item_value(proto_tree *tree, int hfindex, gint start,
if (!tree)
return(NULL);
-
+
+ /* either visibility flag can nullify the other */
+ visible = proto_tree_is_visible && visible;
+
fi = g_mem_chunk_alloc(gmc_field_info);
fi->hfinfo = find_hfinfo_record(hfindex);