free as many as possible!
This commit is contained in:
parent
fdc9bfea4e
commit
9526ca789a
|
@ -104,7 +104,6 @@ expand(pic_state *pic, pic_value obj, struct syntactic_env *env)
|
|||
define_macro(pic, pic_symbol_name(pic, pic_sym(var)), pic_proc_ptr(v));
|
||||
|
||||
pic_gc_arena_restore(pic, ai);
|
||||
pic_gc_protect(pic, v);
|
||||
return pic_false_value();
|
||||
}
|
||||
macro = lookup_macro(pic, env, pic_symbol_name(pic, sym));
|
||||
|
@ -116,7 +115,11 @@ expand(pic_state *pic, pic_value obj, struct syntactic_env *env)
|
|||
}
|
||||
pic_gc_arena_restore(pic, ai);
|
||||
pic_gc_protect(pic, v);
|
||||
return expand(pic, v, env);
|
||||
|
||||
v = expand(pic, v, env);
|
||||
pic_gc_arena_restore(pic, ai);
|
||||
pic_gc_protect(pic, v);
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
13
src/parse.y
13
src/parse.y
|
@ -38,6 +38,7 @@ parser_control_new(pic_state *pic)
|
|||
p->pic = pic;
|
||||
p->incomp = false;
|
||||
p->yynerrs = 0;
|
||||
p->value = pic_undef_value();
|
||||
p->yy_arena = pic_vec_new(pic, YY_ARENA_SIZE);
|
||||
p->yy_arena_idx = 0;
|
||||
yylex_init(&p->yyscanner);
|
||||
|
@ -375,7 +376,6 @@ pic_parse_file(pic_state *pic, FILE *file, pic_value *v)
|
|||
yyparse(p);
|
||||
|
||||
if (p->yynerrs > 0) {
|
||||
p->value = pic_undef_value();
|
||||
r = PIC_PARSER_ERROR;
|
||||
}
|
||||
else if (p->incomp) {
|
||||
|
@ -385,6 +385,8 @@ pic_parse_file(pic_state *pic, FILE *file, pic_value *v)
|
|||
r = pic_length(pic, p->value);
|
||||
}
|
||||
|
||||
*v = p->value;
|
||||
|
||||
parser_control_destroy(p);
|
||||
|
||||
#if DEBUG
|
||||
|
@ -395,8 +397,7 @@ pic_parse_file(pic_state *pic, FILE *file, pic_value *v)
|
|||
|
||||
pic_gc_arena_restore(pic, ai);
|
||||
|
||||
*v = p->value;
|
||||
pic_gc_protect(pic, p->value);
|
||||
pic_gc_protect(pic, *v);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -413,7 +414,6 @@ pic_parse_cstr(pic_state *pic, const char *str, pic_value *v)
|
|||
yyparse(p);
|
||||
|
||||
if (p->yynerrs > 0) {
|
||||
p->value = pic_undef_value();
|
||||
r = PIC_PARSER_ERROR;
|
||||
}
|
||||
else if (p->incomp) {
|
||||
|
@ -423,6 +423,8 @@ pic_parse_cstr(pic_state *pic, const char *str, pic_value *v)
|
|||
r = pic_length(pic, p->value);
|
||||
}
|
||||
|
||||
*v = p->value;
|
||||
|
||||
parser_control_destroy(p);
|
||||
|
||||
#if DEBUG
|
||||
|
@ -434,8 +436,7 @@ pic_parse_cstr(pic_state *pic, const char *str, pic_value *v)
|
|||
|
||||
pic_gc_arena_restore(pic, ai);
|
||||
|
||||
*v = p->value;
|
||||
pic_gc_protect(pic, p->value);
|
||||
pic_gc_protect(pic, *v);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue