Skip to content

Commit

Permalink
make default allocf public to use it with mrb_open_without_mrbgems
Browse files Browse the repository at this point in the history
  • Loading branch information
take-cheeze authored and matz committed Jun 23, 2014
1 parent 6bb56ed commit 36813c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions include/mruby.h
Expand Up @@ -299,6 +299,8 @@ mrb_state* mrb_open_allocf(mrb_allocf, void *ud);
mrb_state* mrb_open_without_mrbgems(mrb_allocf, void *ud);
void mrb_close(mrb_state*);

void* mrb_default_allocf(mrb_state*, void*, size_t, void*);

mrb_value mrb_top_self(mrb_state *);
mrb_value mrb_run(mrb_state*, struct RProc*, mrb_value);
mrb_value mrb_toplevel_run(mrb_state*, struct RProc*);
Expand Down
6 changes: 3 additions & 3 deletions src/state.c
Expand Up @@ -64,8 +64,8 @@ mrb_open_common(mrb_allocf f, void *ud, mrb_bool with_gems)
return mrb;
}

static void*
allocf(mrb_state *mrb, void *p, size_t size, void *ud)
void*
mrb_default_allocf(mrb_state *mrb, void *p, size_t size, void *ud)
{
if (size == 0) {
free(p);
Expand Down Expand Up @@ -111,7 +111,7 @@ mrb_alloca_free(mrb_state *mrb)
mrb_state*
mrb_open(void)
{
mrb_state *mrb = mrb_open_allocf(allocf, NULL);
mrb_state *mrb = mrb_open_allocf(mrb_default_allocf, NULL);

return mrb;
}
Expand Down

0 comments on commit 36813c8

Please sign in to comment.