Re: [gtk-list] Re: g_slist_length()?



//>I have a list (a GSList constructed via g_slist_alloc()).
//>
//>I add five elements to the list, call
//>g_slist_length(list), and I get SIX.
//>
//
//I think this is correct:
//
//you get one node for g_slist_alloc + your five elements.
//
//I guess the right way to do it in this case is not to use g_slist_alloc and
//just append your elements
//to the list.
//
//Something like e.g. 
//
//GSLIST *list = NULL;
//
//g_slist_append( list, el);

Make that:

list = g_slist_append( list, el );

Regards,

Johannes.
--
"If we aren't supposed to eat animals, why are they made of meat?" -Lars Petrus

Visually inspecting visual programming languages.




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