summaryrefslogtreecommitdiff
path: root/epan/proto.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-12-04 10:59:34 +0000
committerGuy Harris <guy@alum.mit.edu>2003-12-04 10:59:34 +0000
commitf0b9d12b6a46e47bba5db8baeb24453396efac9d (patch)
treebf784482d59a9572d596b1c1177beb842447717d /epan/proto.h
parente83aeb6431bc4f1577146e806c5c61a2e7c799a4 (diff)
downloadwireshark-f0b9d12b6a46e47bba5db8baeb24453396efac9d.tar.gz
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
Diffstat (limited to 'epan/proto.h')
-rw-r--r--epan/proto.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/epan/proto.h b/epan/proto.h
index 9c0d3fa55e..7422945748 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -1,7 +1,7 @@
/* proto.h
* Definitions for protocol display
*
- * $Id: proto.h,v 1.51 2003/12/03 09:28:22 guy Exp $
+ * $Id: proto.h,v 1.52 2003/12/04 10:59:34 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -126,24 +126,28 @@ typedef struct {
gboolean visible;
} tree_data_t;
-/* Each GNode (proto_tree, proto_item) points to one of
- * these. */
+/* Each proto_tree, proto_item is one of these. */
typedef struct _proto_node {
+ struct _proto_node *first_child;
+ struct _proto_node *last_child;
+ struct _proto_node *next;
field_info *finfo;
tree_data_t *tree_data;
} proto_node;
-typedef GNode proto_tree;
-typedef GNode proto_item;
+typedef proto_node proto_tree;
+typedef proto_node proto_item;
-/* Retrieve the proto_node from a GNode. */
-#define GNODE_PNODE(t) ((proto_node*)((GNode*)(t))->data)
+typedef void (*proto_tree_foreach_func)(proto_node *, gpointer);
+
+extern void proto_tree_children_foreach(proto_tree *tree,
+ proto_tree_foreach_func func, gpointer data);
/* Retrieve the field_info from a proto_item */
-#define PITEM_FINFO(t) (GNODE_PNODE(t)->finfo)
+#define PITEM_FINFO(t) ((t)->finfo)
/* Retrieve the tree_data_t from a proto_tree */
-#define PTREE_DATA(t) (GNODE_PNODE(t)->tree_data)
+#define PTREE_DATA(t) ((t)->tree_data)
/* Sets up memory used by proto routines. Called at program startup */
extern void proto_init(const char *plugin_dir,