[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why is malloc being defined as rpl_malloc ??
From: |
Mr E_T |
Subject: |
Re: Why is malloc being defined as rpl_malloc ?? |
Date: |
Mon, 5 May 2003 20:54:41 +0800 (WST) |
On Mon, 5 May 2003, Dr. David Kirkby wrote:
> Paul Eggert wrote:
> >
> > "Dr. David Kirkby" <address@hidden> writes:
> >
> > > I would think that if the macro is looking for a GNU compatible
> > > malloc, it should have GNU in the name somewhere.
> >
> > I wouldn't mind changing its name to AC_FUNC_MALLOC_GNU. Could
> > you propose a complete patch along those lines?
>
The test actually checks for a zero length bug in some implementations of
malloc and the autoconf docs recommend a malloc.c file along these lines -
#if HAVE_CONFIG_H
# include <config.h>
#endif
#undef malloc
#include <sys/types.h>
void *malloc ();
/* Allocate an N-byte block of memory from the heap.
If N is zero, allocate a 1-byte block. */
void *
rpl_malloc (size_t n)
{
if (n == 0)
n = 1;
return malloc (n);
}
as you can see it is just a wrapper script.
This is straight from the autoconf info document.
If your code uses malloc then just to be safe - check that it wont bomb if a
zero length is malloced.
If the AC_FUNC_MALLOC test says to use malloc.c then you have the zero length
bug.
and add
prog_LIBADD = @LIBOBJS@
to your Makefile.am
and the above file in your sources.
--
regs MR E_T
_______________________
\ \
\ OOHH I hate TYPOS \
\ \
~~~~~~~~~~~~~~~~~~~~~~~
- Why is malloc being defined as rpl_malloc ??, Dr. David Kirkby, 2003/05/03
- Re: Why is malloc being defined as rpl_malloc ??, Paul Eggert, 2003/05/04
- Re: Why is malloc being defined as rpl_malloc ??, Thomas E. Dickey, 2003/05/04
- Re: Why is malloc being defined as rpl_malloc ??, Dr. David Kirkby, 2003/05/04
- Re: Why is malloc being defined as rpl_malloc ??, Paul Eggert, 2003/05/04
- Re: Why is malloc being defined as rpl_malloc ??, Dr. David Kirkby, 2003/05/05
- Re: Why is malloc being defined as rpl_malloc ??,
Mr E_T <=
- Re: Why is malloc being defined as rpl_malloc ??, Paul Eggert, 2003/05/05
- Message not available
- Re: Why is malloc being defined as rpl_malloc ??, Paul Eggert, 2003/05/05
- Re: Why is malloc being defined as rpl_malloc ??, Dr. David Kirkby, 2003/05/05
Re: Why is malloc being defined as rpl_malloc ??, Jim Meyering, 2003/05/05