don't malloc in pic_interned_p

This commit is contained in:
Yuichi Nishiwaki 2015-01-19 13:12:04 +09:00
parent ca69048513
commit 3b3032ee55
1 changed files with 8 additions and 1 deletions

View File

@ -51,7 +51,14 @@ pic_gensym(pic_state *pic, pic_sym base)
bool bool
pic_interned_p(pic_state *pic, pic_sym sym) pic_interned_p(pic_state *pic, pic_sym sym)
{ {
return sym == pic_intern(pic, sym->str); xh_entry *e;
e = xh_get_str(&pic->syms, pic_str_cstr(sym->str));
if (e) {
return sym == xh_val(e, pic_sym);
} else {
return false;
}
} }
const char * const char *