glib: how to sort a doubly linked list?



Hi
 
i noticed a function in glib called:
	GList* g_list_insert_sorted (GList *list, gpointer data,
				     GCompareFunc func)

I'm wondering how i can use this function on a GList which contains a
pointer to a structure. The structure looks like this:

struct {
	gchar *name
	gchar *version
	...
	}

Now i want to sort the GList alphabetically, looking at the 'name' in
the data structure... Is there a way i can achieve this with the
function above?

Thanks!

Joel Wijngaarde



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