From db38cdc7e0392b1960d8f9c74b736cb5fbc4af60 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Tue, 29 Oct 2013 02:16:26 +0900 Subject: [PATCH] check sym_pool size when interning symbol --- src/symbol.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/symbol.c b/src/symbol.c index e6d98b13..7a84641b 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -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);