mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby.h: remove allocf and allocf_ud from mrb_state
This is preparation for memory allocation restructuring.
This commit is contained in:
@@ -256,9 +256,6 @@ typedef void (*mrb_atexit_func)(struct mrb_state*);
|
||||
typedef struct mrb_state {
|
||||
struct mrb_jmpbuf *jmp;
|
||||
|
||||
mrb_allocf allocf; /* memory allocation function */
|
||||
void *allocf_ud; /* auxiliary data of allocf */
|
||||
|
||||
struct mrb_context *c;
|
||||
struct mrb_context *root_c;
|
||||
struct iv_tbl *globals; /* global variable table */
|
||||
|
||||
@@ -194,10 +194,10 @@ mrb_realloc_simple(mrb_state *mrb, void *p, size_t len)
|
||||
mrb_full_gc(mrb);
|
||||
}
|
||||
#endif
|
||||
p2 = (mrb->allocf)(mrb, p, len, mrb->allocf_ud);
|
||||
p2 = mrb_default_allocf(mrb, p, len, NULL);
|
||||
if (!p2 && len > 0 && mrb->gc.heaps && mrb->gc.state != MRB_GC_STATE_SWEEP) {
|
||||
mrb_full_gc(mrb);
|
||||
p2 = (mrb->allocf)(mrb, p, len, mrb->allocf_ud);
|
||||
p2 = mrb_default_allocf(mrb, p, len, NULL);
|
||||
}
|
||||
|
||||
return p2;
|
||||
@@ -256,7 +256,7 @@ mrb_calloc(mrb_state *mrb, size_t nelem, size_t len)
|
||||
MRB_API void
|
||||
mrb_free(mrb_state *mrb, void *p)
|
||||
{
|
||||
(mrb->allocf)(mrb, p, 0, mrb->allocf_ud);
|
||||
mrb_default_allocf(mrb, p, 0, NULL);
|
||||
}
|
||||
|
||||
MRB_API void*
|
||||
|
||||
@@ -46,8 +46,6 @@ mrb_open_core(mrb_allocf f, void *ud)
|
||||
if (mrb == NULL) return NULL;
|
||||
|
||||
*mrb = mrb_state_zero;
|
||||
mrb->allocf_ud = ud;
|
||||
mrb->allocf = f;
|
||||
mrb->atexit_stack_len = 0;
|
||||
|
||||
if (mrb_core_init_protect(mrb, init_gc_and_core, NULL)) {
|
||||
|
||||
Reference in New Issue
Block a user