use a pointer to newly allocated region to pass to xh_put

This commit is contained in:
Yuichi Nishiwaki 2014-02-06 22:13:42 +09:00
parent 0ecdb5a260
commit 104fd823b2
1 changed files with 3 additions and 1 deletions

View File

@ -21,6 +21,8 @@ pic_intern_cstr(pic_state *pic, const char *str)
return e->val;
}
str = pic_strdup(pic, str);
if (pic->slen >= pic->scapa) {
#if DEBUG
@ -31,7 +33,7 @@ pic_intern_cstr(pic_state *pic, const char *str)
pic->sym_pool = pic_realloc(pic, pic->sym_pool, sizeof(const char *) * pic->scapa);
}
id = pic->slen++;
pic->sym_pool[id] = pic_strdup(pic, str);
pic->sym_pool[id] = str;
xh_put(pic->sym_tbl, str, id);
return id;
}