lua-users home
lua-l archive

Use a self-defined memory acquirement function instead of realloc(3) in the l_alloc function

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


Hi, list
I want to use a self-defined memory acquirement function instead of
using realloc(3) in the l_alloc function.
Since I am a newbie, I don't know if there are some potential problems.
Could somebody shed some light on this problem?
Thank you for your attention to this matter.
For your convenience, here is the original l_alloc() function for lua.
static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
 (void)ud; (void)osize; /* not used */
 if (nsize == 0) {
 free(ptr);
 return NULL;
 }
 else
 return realloc(ptr, nsize);
}
Best regards.
Sunshilong

AltStyle によって変換されたページ (->オリジナル) /