mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-compiler: removed mrb_state dependency from two functions
- mrb_ccontext_partial_hook - mrb_ccontext_cleanup_local_variables
This commit is contained in:
@@ -41,8 +41,8 @@ typedef struct mrb_ccontext {
|
||||
MRB_API mrb_ccontext* mrb_ccontext_new(mrb_state *mrb);
|
||||
MRB_API void mrb_ccontext_free(mrb_state *mrb, mrb_ccontext *cxt);
|
||||
MRB_API const char *mrb_ccontext_filename(mrb_state *mrb, mrb_ccontext *c, const char *s);
|
||||
MRB_API void mrb_ccontext_partial_hook(mrb_state *mrb, mrb_ccontext *c, int (*partial_hook)(struct mrb_parser_state*), void*data);
|
||||
MRB_API void mrb_ccontext_cleanup_local_variables(mrb_state *mrb, mrb_ccontext *c);
|
||||
MRB_API void mrb_ccontext_partial_hook(mrb_ccontext *c, int (*partial_hook)(struct mrb_parser_state*), void*data);
|
||||
MRB_API void mrb_ccontext_cleanup_local_variables(mrb_ccontext *c);
|
||||
|
||||
/* compatibility macros */
|
||||
#define mrbc_context mrb_ccontext
|
||||
|
||||
@@ -531,7 +531,7 @@ main(int argc, char **argv)
|
||||
mrb_load_file_cxt(mrb, lfp, cxt);
|
||||
fclose(lfp);
|
||||
mrb_vm_ci_env_clear(mrb, mrb->c->cibase);
|
||||
mrb_ccontext_cleanup_local_variables(mrb, cxt);
|
||||
mrb_ccontext_cleanup_local_variables(cxt);
|
||||
}
|
||||
|
||||
#ifndef MRB_NO_MIRB_UNDERSCORE
|
||||
|
||||
@@ -245,7 +245,7 @@ load_file(mrb_state *mrb, struct mrbc_args *args)
|
||||
args->idx++;
|
||||
if (args->idx < args->argc) {
|
||||
need_close = FALSE;
|
||||
mrb_ccontext_partial_hook(mrb, c, partial_hook, (void*)args);
|
||||
mrb_ccontext_partial_hook(c, partial_hook, (void*)args);
|
||||
}
|
||||
|
||||
result = mrb_load_file_cxt(mrb, infile, c);
|
||||
|
||||
@@ -339,7 +339,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
fclose(lfp);
|
||||
mrb_vm_ci_env_clear(mrb, mrb->c->cibase);
|
||||
mrb_ccontext_cleanup_local_variables(mrb, c);
|
||||
mrb_ccontext_cleanup_local_variables(c);
|
||||
}
|
||||
|
||||
/* set program filename */
|
||||
|
||||
@@ -6767,17 +6767,17 @@ mrb_ccontext_filename(mrb_state *mrb, mrb_ccontext *c, const char *s)
|
||||
}
|
||||
|
||||
MRB_API void
|
||||
mrb_ccontext_partial_hook(mrb_state *mrb, mrb_ccontext *c, int (*func)(struct mrb_parser_state*), void *data)
|
||||
mrb_ccontext_partial_hook(mrb_ccontext *c, int (*func)(struct mrb_parser_state*), void *data)
|
||||
{
|
||||
c->partial_hook = func;
|
||||
c->partial_data = data;
|
||||
}
|
||||
|
||||
MRB_API void
|
||||
mrb_ccontext_cleanup_local_variables(mrb_state *mrb, mrb_ccontext *c)
|
||||
mrb_ccontext_cleanup_local_variables(mrb_ccontext *c)
|
||||
{
|
||||
if (c->syms) {
|
||||
mrb_free(mrb, c->syms);
|
||||
mrbc_free(c->syms);
|
||||
c->syms = NULL;
|
||||
c->slen = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user