check sym_pool size when interning symbol

This commit is contained in:
Yuichi Nishiwaki 2013-10-29 02:16:26 +09:00
parent 0bf0c29af2
commit db38cdc7e0
1 changed files with 4 additions and 0 deletions

View File

@ -15,6 +15,10 @@ pic_intern_cstr(pic_state *pic, const char *str)
return e->val;
}
if (pic->slen >= pic->scapa) {
pic->scapa *= 2;
pic->sym_pool = pic_realloc(pic, pic->sym_pool, sizeof(const char *) * pic->scapa);
}
id = pic->slen++;
pic->sym_pool[id] = strdup(str);
xh_put(pic->sym_tbl, str, id);