GList
- From: Tristan Sloughter <kungfooguru gmail com>
- To: gtk-app-devel-list gnome org
- Subject: GList
- Date: Thu, 18 Aug 2005 00:52:45 -0500
I am using GLists and want to make sure I am freeing all the memory, and
not twice or course.
There are three possible functions for removing an element from the list:
g_list_remove (GList *list, gconstpointer data);
g_list_remove_link (GList *list, GList *llink);
g_list_delete_link (GList *list, GList *link_);
typedef struct {
gpointer data;
GList *next;
GList *prev;
} GList;
So, I want to be sure that /gpointer data/ is freed when I remove the
element from the list. If I call/ g_list_remove(...)/ will that take
care of freeing data? If so should I use glib allocating functions for
allocating the memory that /data/ points to, since it'll probably use
/g_free/ to free the /data/, or does it matter?
What is the difference between /remove_link/ and /delete_link/? If I
used /remove_link (...)/ I assume I'd have to free the memory pointed to
by /data/ on my own, that being the difference between /remove/ and
/remove_link/.
Thanks in advance,
Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]