Re: g_*printf() (Was: gtk+-1.1.6 report)



Quoting Andreas Tille (tille@physik.uni-halle.de):

> > And g_snprintf, cuz it's always available and doesn't hurt to be safe.  :)
> > Even malloc'd strings can overflow sometimes, given the "right" input.
> I would like to suggest
>
>    gchar *g_printf_new(gchar const *fmt, ...)
>
> which returns a pointer to a string with apropriate length.
> In my humble opinion this is a very often needed thing.

Along these lines, I'd suggest a "out-of-memory" hook. The standard hook
should abort the program. The reason behind this is that the program should
print a meaningful error when it runs out of memory but most people
don't want to add a check after every invokation of g_printf_new().
(and that should be g_sprintf_new() :-)

--
Aaron "Optimizer" Digulla             Team AMIGA     AROS Head of Development
Author of XDME, ResTrackLib, CInt.		       <http://www.aros.org/>
"(to) optimize: Make a program faster by improving the algorithms rather than
by buying a faster machine."



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