Re: what if g_strdup_printf() fails?



On 2002.09.14 22:49 Scott Barron wrote:
Looking through the source it looks like deep down inside it uses
malloc().  It looks like it goes through g_new() which uses g_malloc()
which uses the standard_malloc() set up in the glib_mem_vtable which
then calls malloc().  Looking at the source for g_malloc() you'll see
that if glib_mem_vtable.malloc() fails it posts a g_error() about it and
returns NULL.  Please correct me if I'm off about any of this (using
2.0.6 sources).

Hmm, the manual says about g_malloc that if allocation fails that the application is terminated. I think I'll construct my own version of strdup_printf(), since I've so complex cleaning to do before the application should terminate.

Thanks for the reply,

Remco Poelstra



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