From 89bde6a8258de710b9032a5e32ffe9346be3c45f Mon Sep 17 00:00:00 2001 From: guy 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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9171 f5534014-38df-0310-8fa8-9805f1628bb7 --- gtk/proto_draw.c | 14 ++++++-------- gtk/rtp_analysis.c | 16 ++++++++-------- 2 files changed, 14 insertions(+), 16 deletions(-) (limited to 'gtk') diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c index a580b79a0a..90b168c722 100644 --- a/gtk/proto_draw.c +++ b/gtk/proto_draw.c @@ -1,7 +1,7 @@ /* proto_draw.c * Routines for GTK+ packet display * - * $Id: proto_draw.c,v 1.70 2003/12/01 02:01:56 guy Exp $ + * $Id: proto_draw.c,v 1.71 2003/12/04 10:59:34 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -116,7 +116,7 @@ add_byte_tab(GtkWidget *byte_nb, const char *name, tvbuff_t *tvb, proto_tree *tree, GtkWidget *tree_view); static void -proto_tree_draw_node(GNode *node, gpointer data); +proto_tree_draw_node(proto_node *node, gpointer data); /* Get the current text window for the notebook. */ GtkWidget * @@ -1603,8 +1603,7 @@ proto_tree_draw(proto_tree *protocol_tree, GtkWidget *tree_view) gtk_tree_store_clear(store); #endif - g_node_children_foreach((GNode*) protocol_tree, G_TRAVERSE_ALL, - proto_tree_draw_node, &info); + proto_tree_children_foreach(protocol_tree, proto_tree_draw_node, &info); #if GTK_MAJOR_VERSION < 2 gtk_clist_thaw(GTK_CLIST(tree_view)); @@ -1612,7 +1611,7 @@ proto_tree_draw(proto_tree *protocol_tree, GtkWidget *tree_view) } static void -proto_tree_draw_node(GNode *node, gpointer data) +proto_tree_draw_node(proto_node *node, gpointer data) { struct proto_tree_draw_info info; struct proto_tree_draw_info *parent_info = (struct proto_tree_draw_info*) data; @@ -1641,7 +1640,7 @@ proto_tree_draw_node(GNode *node, gpointer data) proto_item_fill_label(fi, label_str); } - if (g_node_n_children(node) > 0) { + if (node->first_child != NULL) { is_leaf = FALSE; g_assert(fi->tree_type >= 0 && fi->tree_type < num_tree_types); if (tree_is_expanded[fi->tree_type]) { @@ -1676,8 +1675,7 @@ proto_tree_draw_node(GNode *node, gpointer data) #else info.iter = &iter; #endif - g_node_children_foreach(node, G_TRAVERSE_ALL, - proto_tree_draw_node, &info); + proto_tree_children_foreach(node, proto_tree_draw_node, &info); #if GTK_MAJOR_VERSION >= 2 path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); if (is_expanded) diff --git a/gtk/rtp_analysis.c b/gtk/rtp_analysis.c index de4b0d8ecf..03257a9468 100644 --- a/gtk/rtp_analysis.c +++ b/gtk/rtp_analysis.c @@ -1,7 +1,7 @@ /* rtp_analysis.c * RTP analysis addition for ethereal * - * $Id: rtp_analysis.c,v 1.12 2003/12/03 09:28:26 guy Exp $ + * $Id: rtp_analysis.c,v 1.13 2003/12/04 10:59:34 guy Exp $ * * Copyright 2003, Alcatel Business Systems * By Lars Ruoff @@ -1770,11 +1770,11 @@ void create_rtp_dialog(user_data_t* user_data) /****************************************************************************/ -static gboolean process_node(proto_item *ptree_node, header_field_info *hfinformation, +static gboolean process_node(proto_node *ptree_node, header_field_info *hfinformation, const gchar* proto_field, guint32* p_result) { field_info *finfo; - proto_item *proto_sibling_node; + proto_node *proto_sibling_node; header_field_info *hfssrc; ipv4_addr *ipv4; @@ -1784,8 +1784,8 @@ static gboolean process_node(proto_item *ptree_node, header_field_info *hfinform hfssrc = proto_registrar_get_byname((gchar*) proto_field); if (hfssrc == NULL) return FALSE; - for(ptree_node=g_node_first_child(ptree_node); ptree_node!=NULL; - ptree_node=g_node_next_sibling(ptree_node)) { + for(ptree_node=ptree_node->first_child; ptree_node!=NULL; + ptree_node=ptree_node->next) { finfo=PITEM_FINFO(ptree_node); if (hfssrc==finfo->hfinfo) { if (hfinformation->type==FT_IPv4) { @@ -1800,7 +1800,7 @@ static gboolean process_node(proto_item *ptree_node, header_field_info *hfinform } } - proto_sibling_node = g_node_next_sibling(ptree_node); + proto_sibling_node = ptree_node->next; if (proto_sibling_node) { return process_node(proto_sibling_node, hfinformation, proto_field, p_result); @@ -1815,14 +1815,14 @@ static gboolean get_int_value_from_proto_tree(proto_tree *protocol_tree, const gchar* proto_field, guint32* p_result) { - proto_item *ptree_node; + proto_node *ptree_node; header_field_info *hfinformation; hfinformation = proto_registrar_get_byname((gchar*) proto_name); if (hfinformation == NULL) return FALSE; - ptree_node = g_node_first_child(protocol_tree); + ptree_node = ((proto_node *)protocol_tree)->first_child; if (!ptree_node) return FALSE; -- cgit v1.2.3