> > Hello! > > Is there any interest to include these extensions to GTree in glib-1.3? > > > > void g_tree_traverse_interval( GTree*, GTraverseFunc, GTraverseType, > > gconstpointer key_min, gconstpointer key_max, gpointer data); > > gpointer g_tree_before(GTree*, gconstpointer key ); > > gpointer g_tree_after(GTree*, gconstpointer key); > > i don't see a reason not to include these, and it seems like no one else > objects. > > a few notes on the implementation though, first, get rid of the excessive > newlines in your patch. then, we put spaces around parantheses e.g. > if (foo) instead of if(foo) and g_tree_key_after (node->left, compare, key); > instead of g_tree_key_after(node->left, compare, key ); > > also i'm not much in favour of bloating the existing traversal functions, ala > -static gint g_tree_node_in_order (GTreeNode *node, > +static gint g_tree_node_in_order_interval (GTreeNode *node, > GTraverseFunc traverse_func, > + GCompareFunc compare, > + gconstpointer key_min, > + gconstpointer key_max, > gpointer data); > simply do: > > static gint > g_tree_node_in_order (GTreeNode *node, > [...] > } > + > +static gint > +g_tree_node_in_order_interval (GTreeNode *node, > +[...] > +} > > to avoid a penalty for the common case due to the new functionality. > keeping the _interval variant close to the normal traversal function > will catch peoples attention to fix both, if there's some general > traversal patch to apply. Sorry! I missed your letter... :( Anyway, here are the improved patches ( Created using cvs diff -u glib/gtree.c cvs diff -u glib/glib.h cvs diff -u glib/tests/tree-test.c I hope I got it all right this time... :) /* Liss */
Attachment:
GTREE.DIFF
Description: Binary data
Attachment:
HEADER.DIFF
Description: Binary data
Attachment:
TREETEST.DIFF
Description: Binary data