Re: string return result conventions
- From: Tim Janik <timj imendio com>
- To: Luke Kenneth Casson Leighton <lkcl lkcl net>
- Cc: Gtk+ Developers <gtk-devel-list gnome org>
- Subject: Re: string return result conventions
- Date: Tue, 16 Sep 2008 10:38:06 +0200 (CEST)
On Mon, 15 Sep 2008, Luke Kenneth Casson Leighton wrote:
ok - can i ask people a favour? could you kindly review e.g.... this:
just looking at it myself, i think where i use fromUTF8 i have a
... but after looking at it again i don't think i have..
there, but key question: in the use of
g_value_set_string() - that "takes over" the memory passed in to it,
... i should be using g_value_take_string(), shouldn't i?
g_value_set_string() duplicates your string internally.
g_value_take_string() takes over ownership of your string and
frees it with g_free(). That is, you might only pass in strings
that have been allocated with g_malloc/g_new/g_strdup/g_*,
because only those require a matching g_free() call.
] [Thread Prev