change pic_dict_for_each interface

This commit is contained in:
Yuichi Nishiwaki
2015-01-25 20:44:35 +09:00
parent e3833eb039
commit 499b68c835
3 changed files with 10 additions and 10 deletions
+3 -6
View File
@@ -19,12 +19,9 @@ struct pic_dict {
struct pic_dict *pic_make_dict(pic_state *);
#define pic_dict_for_each(sym, dict) \
pic_dict_for_each_helper_((sym), PIC_GENSYM(tmp), (dict))
#define pic_dict_for_each_helper_(var, tmp, dict) \
for (xh_entry *tmp = xh_begin(&dict->hash); \
(tmp && ((var = xh_key(tmp, pic_sym *)), 1)); \
tmp = xh_next(tmp))
#define pic_dict_for_each(sym, dict, it) \
for (it = xh_begin(&(dict)->hash); it != NULL; it = xh_next(it)) \
if ((sym = xh_key(it, pic_sym *)), true)
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);