lua-users home
lua-l archive

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


> static void* LuaAllocator( void* ud, void* ptr, size_t osize, size_t nsize )
> {
>   linear_allocator_t* lalloc = (linear_allocator_t*)ud;
>   void* nptr = 0;
>   
>   if ( nsize != 0 )
>   {
>     if ( osize < nsize )
>     {
>       nptr = linear_allocator_malloc( lalloc, nsize );
>     }
>     else
>     {
>       nptr = ptr;
>     }
>   }
>   [...]
>   return nptr;
> }

When growing a block, shouldn't you copy the contents of the old block
to the new one?

-- Roberto