[PATCH] g_tree_foreach_range and GCompletion



Hello,
i have added a function to traverse a GTree from a min key to a max
key, that IMHO
is one of the most useful things that can be done with a balanced
binary tree :-),
as i found no other way to do it without traversing all the tree up to max_key.

I am attaching my (very small) patch and a test program that prints a
range of strings in a file lines.

I have also seen that GCompletion does a linear search, and i am going
to reimplement it
with a GTree because in my program the search could be done in a quite
large string set.
If you are interested i will submit the implementation, but there
could be (little) problems for ABI
compatibility because GCompletionStrncmpFunc is actually *required*
only to return 0 if the
strings are equal and non 0 elsewere (even if in the documentation it
is stated in slightly different
way), while a GTree implementation would really require the
GCompletionStrncmpFunc to
return a value greater, equal or less then 0 in the right alphabetical
way (as strcmp does).
Maybe this could break some program.
I also don't know if there could be any problem with UTF-8.
As a good thing a GTree-ish implementation of GCompletion would also
have that the
strings returned are gratuituously sorted alphabetically.

If you have been so kind to read my mail till here and after all you
are still interested in my
implementation, just tell me, so that i will keep my code in a glib-is
style while writing it :-)

Thanks to all glib developers, here are just my .02€
Maurizio Monge



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]