number list elements problem

2003-12-26 Thread francex
Hi, my program use a list to collect datas. At start obviously it returns: g_slist_length (list) = 0 any lines are append: list = g_slist_append (list, (gpointer) node); ('node' is a struct pointer with many 'gchar *' elements) These lineas are casually deleted: g_free (g_slist_nth_data (list,

Re: number list elements problem

2003-12-26 Thread Sven Neumann
Hi, [EMAIL PROTECTED] writes: > g_slist_remove_link (list, g_slist_nth (list, position)); You _always_ need to assign the returned list argument to your list pointer or your code will break if the head of the list is modified. Try to change that line to list = g_slist_remove_link (list, g_sli

Re: number list elements problem

2003-12-26 Thread francex
Hi, thank you very much Sven, now it works:) 2 questions again: > list = g_slist_remove_link (list, g_slist_nth (list, position)); > BTW, you are using the list in a very inefficient way here. In order > for the node to be removed the list is traversed twice. Yes I know it... How can I remove