Skip to content

Commit 4399a84

Browse files
committed
mrc_ccontext_cleanup_local_variables()
1 parent 7b75d48 commit 4399a84

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

include/mrc_ccontext.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ typedef struct mrc_ccontext {
6767
} mrc_ccontext; /* compiler context */
6868

6969
mrc_ccontext *mrc_ccontext_new(mrb_state *mrb);
70+
void mrc_ccontext_cleanup_local_variables(mrc_ccontext *c);
7071
const char *mrc_ccontext_filename(mrc_ccontext *c, const char *s);
7172
void mrc_ccontext_free(mrc_ccontext *c);
7273

src/ccontext.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ mrc_ccontext_new(mrb_state *mrb)
1717
return c;
1818
}
1919

20+
21+
MRC_API void
22+
mrc_ccontext_cleanup_local_variables(mrc_ccontext *c)
23+
{
24+
if (c->syms) {
25+
mrc_free(c->syms);
26+
c->syms = NULL;
27+
c->slen = 0;
28+
}
29+
c->keep_lv = FALSE;
30+
}
31+
2032
MRC_API const char *
2133
mrc_ccontext_filename(mrc_ccontext *c, const char *s)
2234
{

0 commit comments

Comments
 (0)