use a pointer to newly allocated region to pass to xh_put
This commit is contained in:
+3
-1
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user