[asterisk-dev] Problems with ast_realloc Version 1.4.5
tilghman at mail.jeffandtilghman.com
Mon Jun 25 16:03:54 CDT 2007
On Monday 25 June 2007 13:40, Russell Bryant wrote:
> Matthew Fredrickson wrote:
> > Alloca() does not allocate memory on the heap, like malloc() and
> > friends. It allocates memory on the stack. That's why you can't
> > realloc the pointer.
> However, I think we have an ast_realloca() somewhere, but the name is
> quite deceiving. It doesn't reallocate anything. It just allocates
> a new block on the stack and copies the data from the old buffer into
> the new one.
We have a struct ast_realloca and we have a macro defined to use it,
called ast_restrdupa(). Given that nothing currently uses it and given
that it's rather wasteful of stack space, I'm for removing it.
More information about the asterisk-dev