From f0b9d12b6a46e47bba5db8baeb24453396efac9d Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 4 Dec 2003 10:59:34 +0000 Subject: Don't use GNodes for the protocol tree, put the sibling pointer, and pointers to the first *and* last child, in the "proto_node" structure itself. That saves us one level of indirection and memory allocation, and lets us append to a tree by appending to the last child directly, rather than having to scan through the list of siblings of the first child to find the end of that list. svn path=/trunk/; revision=9171 --- proto_hier_stats.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'proto_hier_stats.c') diff --git a/proto_hier_stats.c b/proto_hier_stats.c index 266c7dd070..641ee0d24c 100644 --- a/proto_hier_stats.c +++ b/proto_hier_stats.c @@ -1,7 +1,7 @@ /* proto_hier_stats.c * Routines for calculating statistics based on protocol. * - * $Id: proto_hier_stats.c,v 1.19 2003/12/03 09:28:19 guy Exp $ + * $Id: proto_hier_stats.c,v 1.20 2003/12/04 10:59:33 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -76,11 +76,11 @@ find_stat_node(GNode *parent_stat_node, header_field_info *needle_hfinfo) static void -process_node(proto_item *ptree_node, GNode *parent_stat_node, ph_stats_t *ps, guint pkt_len) +process_node(proto_node *ptree_node, GNode *parent_stat_node, ph_stats_t *ps, guint pkt_len) { field_info *finfo; - ph_stats_node_t *stats; - proto_item *proto_sibling_node; + ph_stats_node_t *stats; + proto_node *proto_sibling_node; GNode *stat_node; finfo = PITEM_FINFO(ptree_node); @@ -95,7 +95,7 @@ process_node(proto_item *ptree_node, GNode *parent_stat_node, ph_stats_t *ps, gu stats->num_pkts_total++; stats->num_bytes_total += pkt_len; - proto_sibling_node = g_node_next_sibling(ptree_node); + proto_sibling_node = ptree_node->next; if (proto_sibling_node) { process_node(proto_sibling_node, stat_node, ps, pkt_len); @@ -111,9 +111,9 @@ process_node(proto_item *ptree_node, GNode *parent_stat_node, ph_stats_t *ps, gu static void process_tree(proto_tree *protocol_tree, ph_stats_t* ps, guint pkt_len) { - proto_item *ptree_node; + proto_node *ptree_node; - ptree_node = g_node_first_child(protocol_tree); + ptree_node = ((proto_node *)protocol_tree)->first_child; if (!ptree_node) { return; } -- cgit v1.2.3