[Top][All Lists]

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

[Bug-gnulib] Re: malloc wrappers

From: Bruno Haible
Subject: [Bug-gnulib] Re: malloc wrappers
Date: Mon, 24 Nov 2003 12:56:26 +0100
User-agent: KMail/1.5

Paul Eggert wrote:
> While we're on the subject, ideally there would be a way for the
> application and for library modules to say something like this: "here
> are the properties I need for malloc: it must never return NULL unless
> it's really out of storage, and it must never allocate SIZE_MAX or
> more bytes".  At link-time, gnulib would select the proper malloc
> wrapper for each application, by taking the union of all the
> requirements.  I don't know of any easy way to implement this,
> unfortunately.

A clean way to implement this is to define a name for each of these
variants of malloc, like zerofixed_malloc, ptrdiff_safe_malloc, etc.,
and let each module explicitly use the one it needs.

That's the way that has been started with calloc(), xmalloc() etc.,
and it works well.


reply via email to

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