Re: GStrings and sorting GLists




On Sun 12/17, David <yeti physics muni cz> wrote:
Are there no comparison operations other than g_string_equal in
order to facilitate the sorting of GList objects that contain
GStrings?
Any C stringcomparison function is usable on gstring->str.  Yes,
you have to write the one-line wrapper yourself

I've found it useful in my travels throughout GTK to write a small wrapper header file with collections of 
these things, which I then include right after standard ones.  Each section of the wrapper is conditionally 
compiled if the associated GTK header has been loaded.

Little things like I like those #define type casing macros, so I'll have a bunch of them for castings 
miscellaneous structs (is there actually a reason GTK provides casting macros for some structs but not 
others?).

I've also got a couple special-purpose g_slist_free type functions that will release the data of a GSList as 
well as the list itself (one for g_malloc()d memory, one for GObjects, etc.), a GSList find and 
exchange/remove function, and some other gems that I find myself wanting all over the place.

Basically every time I go hunting for a piece of code I'd previously written for something else, I'll drop it 
into one of my GTK-wrapper libraries.

This sort of thing is exactly where a little extras library shines.


Fredderic

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!





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