Re: GList



On Thu, 18 Aug 2005 20:17:34 +0100
Chris Vine <chris cvine freeserve co uk> wrote:

On Thursday 18 August 2005 08:51, HuamiSoft Hubert Sokolowski wrote:

always when you allocate a memory, you need to free it by your self.
to free a list completely you need to free /data/ by your self if it
points to some memory that you allocated. g_list_remove removes an
element from a list and frees that element (but without freeing /data/).
g_list_remove_link removes an element without freeing it, but also sets
next and prev to NULL.
g_list_delete_link just removes an element without freeing it, but next
and prev still point where they were pointed.

Actually, g_list_delete_link() does free the link element (it calls 
_g_list_free_1()).  It is g_list_remove_link() which does not.  
g_list_remove_link() in effect starts a new list.

To the other poster who said the documentation was quite clear ...
yes, for this function the docs are not very clear.


-- 
HuamiSoft Hubert Sokolowski
http://www.huamisoft.com/
tel. (085) 7465779
kom. +48501456743



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