Fixed wrong condition in new_sym() that breaks symbol data.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2016-12-13 02:32:50 +09:00
parent a4ae22ae0c
commit 647ad29a7a
+2 -1
View File
@@ -537,7 +537,8 @@ new_sym(codegen_scope *s, mrb_sym sym)
if (s->irep->slen == MAXSYMLEN) {
codegen_error(s, "too many symbols (max " MRB_STRINGIZE(MAXSYMLEN) ")");
}
if (s->scapa == MAXMSYMLEN) {
if (s->irep->slen > MAXMSYMLEN/2 && s->scapa == MAXMSYMLEN) {
s->scapa = MAXSYMLEN;
s->irep->syms = (mrb_sym *)codegen_realloc(s, s->irep->syms, sizeof(mrb_sym)*MAXSYMLEN);
for (i = s->irep->slen; i < MAXMSYMLEN; i++) {