Mail Archives: djgpp/2001/01/23/17:06:32
Hello.
Damian Yerrick wrote:
>
> On Mon, 22 Jan 2001 20:44:01 -0500, DJ Delorie <dj AT delorie DOT com> wrote:
>
> > > Save your pointer to the old memory block before attempting to
> > > realloc.
> >
> > DJGPP's code allows this, but I didn't realize you could rely on it.
>
> Anyone up for a patch to the realloc() docs?
I posted a patch to djgpp-workers to clarify what happens to the old
memory block, when realloc() fails. This patch was committed to DJGPP CVS
on Fri, 27 Oct 2000. Here is the updated description:
"Description
-----------
This function changes the size of the region pointed to by PTR. If it
can, it will reuse the same memory space, but it may have to allocate a
new memory space to satisfy the request. In either case, it will
return the pointer that you should use to refer to the (possibly new)
memory area. The pointer passed may be `NULL', in which case this
function acts just like `malloc' (*note malloc::).
Return Value
------------
On success, a pointer is returned to the memory you should now refer
to. On failure, `NULL' is returned and PTR is not freed."
Bye,
--
Richard Dawe <richdawe AT bigfoot DOT com> http://www.bigfoot.com/~richdawe/
"The soul is the mirror of an indestructible universe."
--- Gottfried W. Leibniz
- Raw text -