Re: thoughts on g-list




Jeff Garzik <jgarzik@pobox.com> writes:

> Two things I noticed during my Gtk+ bughunt:
> 
> 1 - A lot of code spends time tracking the (a) size and (b) tail ptr of
> a GList.  Would be nice if we could cache these values.

Well, somebody could write a GQueue or something on top of
GList.
 
> 2 - A lot of code calls these two functions, one right after another:
> 	g_list_remove_links (list, old_node)
> 	g_list_free1 (old_node)
> Can this be combined into a g_list_remove_link function perhaps?

That first function is called g_list_remove_link() not links()
already. We could add a g_list_delete_link (list, node), 
easily enough.

(But we've already frozen the API for 1.2, and I'm hesistant
 to keep adding functions. This one won't hurt us, but 
 if people start using it in GNOME (e.g), it introduces the 
 version dependencies that the freeze was supposed to fix.)

> Or should g_list_free/g_list_free1 check their arguments, as necessary,
> and unlink themselves from any existing list?

No, the latter will almost certainly produce segfaults in
existing code.

                                        Owen



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