diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-04-01 02:00:53 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-04-01 02:00:53 +0000 |
commit | 5de2533f2d369ae001875b29ec89a584d9889afb (patch) | |
tree | fd5532f8d6382a0411199c05a644db3c96ddbb76 /print.c | |
parent | d1f2aaf8ac5c590e2b9390ac44fe6f1a2e8a0667 (diff) |
Start assigning ett_ values at 0, rather than 1; get rid of the reserved
ETT_NONE entry.
Initialize the "tree_type" field of a "field_info" structure to -1,
meaning "this has not been given a subtree". Add checks before using
that field that it's in range. That way, you have to create a subtree
before putting protocol tree items under another item.
We allocate the "tree_is_expanded" array when we've registered all
dissectors; there's no need to allocate it while we're registering
dissectors and, in fact, doing so means we leak memory (the memory for
the version we allocated while registering dissectors).
svn path=/trunk/; revision=5068
Diffstat (limited to 'print.c')
-rw-r--r-- | print.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1,7 +1,7 @@ /* print.c * Routines for printing packet analysis trees. * - * $Id: print.c,v 1.43 2002/03/31 20:56:59 guy Exp $ + * $Id: print.c,v 1.44 2002/04/01 02:00:50 guy Exp $ * * Gilbert Ramirez <gram@alumni.rice.edu> * @@ -199,6 +199,7 @@ void proto_tree_print_node_text(GNode *node, gpointer data) /* If we're printing all levels, or if this level is expanded, recurse into the subtree, if it exists. */ + g_assert(fi->tree_type >= 0 && fi->tree_type < num_tree_types); if (pdata->print_all_levels || tree_is_expanded[fi->tree_type]) { if (g_node_n_children(node) > 0) { pdata->level++; |