add pic_dict_has

This commit is contained in:
Yuichi Nishiwaki 2014-07-13 17:01:55 +09:00
parent 73c406ed42
commit 54d50d57a1
2 changed files with 9 additions and 0 deletions

View File

@ -23,6 +23,7 @@ pic_value pic_dict_ref(pic_state *, struct pic_dict *, pic_sym);
void pic_dict_set(pic_state *, struct pic_dict *, pic_sym, pic_value);
void pic_dict_del(pic_state *, struct pic_dict *, pic_sym);
size_t pic_dict_size(pic_state *, struct pic_dict *);
bool pic_dict_has(pic_state *, struct pic_dict *, pic_sym);
#if defined(__cplusplus)
}

View File

@ -44,6 +44,14 @@ pic_dict_size(pic_state *pic, struct pic_dict *dict)
return dict->hash.count;
}
bool
pic_dict_has(pic_state *pic, struct pic_dict *dict, pic_sym key)
{
UNUSED(pic);
return xh_get_int(&dict->hash, key) != NULL;
}
void
pic_dict_del(pic_state *pic, struct pic_dict *dict, pic_sym key)
{