Re: Followup: GtkTree update
- From: jrb redhat com
- To: gtk-devel-list gnome org
- Subject: Re: Followup: GtkTree update
- Date: Tue, 03 Oct 2000 12:04:10 -0400
> These kinds of interfaces (node_nth_child) are dangerous. I've fixed a
> few misuses of things like it in mozilla. The problem is that the
> interface makes it look like a O(1) operation to get the nth
> child. This can lead to (it did in the mozilla code) users coding
> stuff like:
>
> n = node_n_children()
> for (i=0; i < n; i++) {
> node = node_nth_child(i);
> do_some_stuff(node);
> }
> Since the implementation of the children often are lists, this loop
> has O(n^2) behaviour. Now, the correct way to do this loop would be to
> use node_children and node_next, but that is not obvious from the
> interface.
>
> Is there any specific reason you added the node_nth_child call?
Apparently I don't use it in gtktreeview anymore. It was previously
used to manually walk down a path to find a specific node, never in a
loop situation (that's what the "node_next" signal is for). However, I
may remove it as it doesn't seem to be used anywhere.
> > /* Only meaningful if GTK_TREE_SELECTION_SINGLE is set */
> > /* User selected_foreach for GTK_TREE_SELECTION_MULTI */
>
> ^^^^ I suppose you mean "Use"
Yes, Fixed.
Thanks,
-Jonathan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]