Re: Glib - more effective code - GNode
- From: Havoc Pennington <hp redhat com>
- To: "Michal Burda" <michal burda centrum cz>
- Cc: "GTK forum (gtk-list)" <gtk-list gnome org>
- Subject: Re: Glib - more effective code - GNode
- Date: 21 Sep 2000 00:11:49 -0400
"Michal Burda" <michal burda centrum cz> writes:
> Hi
>
> in file gnode.c, function g_node_first_sibling():
>
> ...
> while (node->prev)
> node = node->prev
> return node
> ...
>
>
> More effective this:????
> ...
> g_return_val_if_fail(node->parent != NULL, node);
> node = node->parent->children;
> return node;
> ...
>
Except you need to handle the root node:
if (node->parent)
return node->parent->children;
else
{
while (node->prev)
node = node->prev;
return node;
}
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]