Re: [gtk-list] Re: newbie g_list_remove prob
- From: Havoc Pennington <hp redhat com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: newbie g_list_remove prob
- Date: Thu, 5 Aug 1999 22:40:35 -0700 (PDT)
On Thu, 5 Aug 1999, Timothy I. McGinnis wrote:
> Ouch.
> Yes, I assigned the return value back to my list variable.
> Yes, I was thinking it compared contents. But then I assume a glist can
> contain
> anything, not just strings.
>
Right. The GList doesn't know what those pointers point to, so it can only
compare the pointers. If you want to remove-by-value, you want to manually
search the list.
> So then, I should not be freeing the malloc'ed variables I am appending to
> my glist, correct? Because the glist is storing only the pointer and if I
> free the malloc'ed variable the pointer will not be valid any longer.
>
Right, that sounds correct. Just be sure you free the variables when
you're done with them (maybe when you remove them from the list).
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]