Re: Glib2 Please Add - alloca string funcs



Alex Graveley <alex ximian com> writes:

> Hi,
> 
> Can we please add alloca versions of the string utilities g_strdup,
> g_strndup, g_strdup_printf, etc?  These could be inline variants of the
> existing heap allocation functions, and could help speedup
> function-internal string manipulation quite a bit.

As Havoc said, this is almost certainly a 2.2 feature at this time.

But also, these type of functions are a pain to implement portably,
even more so than alloca itself, ... you can't return alloca memory
from a function call, and statement expressions (what the glibc
g_strdupa() uses) are a GCC extension. An alloca g_strdup_printf() is
probably impossible. The others, are feasible at some cost in efficiency.

Regards,
                                        Owen




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