Tom Copeland <[EMAIL PROTECTED]> writes:
> Here's a bit of GIMP "code publicity" I thought folks might be
> interested in. I'm working on a tutorial for IBM's developerWorks site
> on the GLib collections - GSList, GHashTable, GTree, and all that. As
> part of the tutorial, I'm picking out excerpts of various collection
> type usages from a couple of nice open source apps - like the GIMP.
> Here's a list of the references to the GIMP that I've currently got in
> the article:
gimp-2.2.4/app/core/gimppreviewcache.c uses a GSList as a sort of
size-based queue; it holds image previews in a GSList and uses
g_slist_insert_sorted to insert the smaller images first. Oddly,
another function in the same file trims the cache by iterating
over the same GSList and comparing each item to find the smallest
one to remove. Might be a possibility for some optimization there.
The function preview_cache_remove_smallest() which is used to trim the
cache actually uses a different comparison than what is used to keep
the list sorted. Whether this is what the author intended, I don't know.
It might be of interest to your readers to also include GimpList as an
implementation of the GimpContainer class.
Gimp-developer mailing list