bug-gnulib
[Top][All Lists]
Advanced

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

[Bug-gnulib] requirements of 'alloca' module


From: Bruno Haible
Subject: [Bug-gnulib] requirements of 'alloca' module
Date: Thu, 20 Nov 2003 22:21:12 +0100
User-agent: KMail/1.5

Simon Josefsson wrote:
> alloca.c: depends on xmalloc, which I don't always want to use
> (especially if just copy the file and use AC_FUNC_ALLOCA).

Last week we encountered a new requirement about alloca(), namely that
if you have a very strict notion of "safe", then alloca should only be
used for amounts < 4 KB. This means we'll probably soon see a module
'safe-alloca' or so. But it will also use xmalloc. Or else, what would
be your preferred way of indicating an allocation failure? Return NULL,
like malloc() does?

Note that some gnulib code is already sensitive to "#define NO_XMALLOC".
This is used to tell the code to behave like a library: return NULL or
be silent about memory allocation errors, if appropriate, but don't call
exit(). Is this something you would like to see applied to other gnulib
modules? Or is all you need to set an 'xalloc_fail_func' that longjmps
to somewhere?

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]