mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
allocf.c: rename mrb_default_alloc to mrb_basic_alloc_func
Along with removing mrb_state first argument from the function. From mruby 3.2, this function is *not* the default function, but the entry point that can be redefined for the application. The function in `src/allocf.c` is the default *implementation* (using malloc / realloc / free) of the function.
This commit is contained in:
+1
-2
@@ -8,14 +8,13 @@
|
||||
|
||||
/* This function serves as the default memory allocation function and accepts four arguments:
|
||||
*
|
||||
* - `mrb`: An instance of `mrb_state`. It's important to note that for the initial allocation (used to allocate the `mrb_state` itself), `mrb` is set to NULL.
|
||||
* - `p`: The previous pointer to the memory region. For memory allocation, this parameter is NULL.
|
||||
* - `size`: The new size of the memory region to be returned.
|
||||
* - `ud`: User data, represented as a `void*`, which is passed to the `mrb_state`.
|
||||
*/
|
||||
|
||||
void*
|
||||
mrb_default_allocf(mrb_state *mrb, void *p, size_t size, void *ud)
|
||||
mrb_basic_alloc_func(void *p, size_t size, void *ud)
|
||||
{
|
||||
if (size == 0) {
|
||||
/* `free(NULL)` should be no-op */
|
||||
|
||||
Reference in New Issue
Block a user