Re: [gtk-list] 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);


Marcel

/////////////////     Marcel Schaible
///////////    //     Dipl.-Informatiker
///////    // ///     Datablade Development Group
//////    // ////     Verity Datablade
/////    // /////     In my former life I was member of the 
////    // //////     famous ATG IUS Function Team
///    // ///////     phone: (001) (510) 628 3745
//    ///////////     fax  : (001) (510) 628 3880
/////////////////     email:marcels@informix.com
/////////////////     www:http://vader.illustra.com/members/marcels



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