lua-users home
lua-l archive

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


Em seg., 9 de nov. de 2020 às 13:54, Francisco Olarte <folarte@peoplecall.com> escreveu:
Rainier:

On Mon, Nov 9, 2020 at 5:20 PM Ranier Vilela <ranier.vf@gmail.com> wrote:
> Em seg., 9 de nov. de 2020 às 13:04, Francisco Olarte <folarte@peoplecall.com> escreveu:
...
>> single realloc and free ones ( you can do everything with realloc ).
> Including lost the original pointer, if realloc fail.

Only if you are not careful and do "return realloc(old, newsize)" or
something like that. You can equally easily lose the old pointer if
you try malloc or any other function and do not program it right. This
is C memory management 101.
Like this:
l_alloc function (lauxlib.c)
995: return realloc(ptr, nsize);

regards,
Ranier Vilela