Re: g_list_copy



[ Probably would be better on gtk-list ]

Jeff Franks <jcf tpg com au> writes:

> Hi,
> 
> I have a question about the g_list_copy function. Do you have to free
> the copied list returned by this function. The documentation doesn't
> tell you to but the word 'copy' make me feel like I should! 

But not the data that the list nodes point to.

So, yes, you have to call g_list_free() on the result.

The docs say:

====
Copies a #GList.

Note that this is a "shallow" copy. If the list elements consist of pointers
to data, the pointers are copied but the actual data isn't.
====

I think this fine. I'm don't see how a function could possibly copy
a list without somebody having to free the result.

Regards,
                                        Owen




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