From c1e66450866cbe8d0640e845544d4c73e44708dc Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Fri, 1 Aug 2014 18:48:14 +0900 Subject: [PATCH] use brand new API style of xhash --- src/bool.c | 4 ++-- src/symbol.c | 4 ++-- src/write.c | 18 +++++++++--------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/bool.c b/src/bool.c index 74018c63..8f8c75f1 100644 --- a/src/bool.c +++ b/src/bool.c @@ -42,10 +42,10 @@ internal_equal_p(pic_state *pic, pic_value x, pic_value y, size_t depth, xhash * pic_errorf(pic, "Stack overflow in equal\n"); } if (pic_pair_p(x) || pic_vec_p(x)) { - if (xh_get(ht, pic_obj_ptr(x)) != NULL) { + if (xh_get_ptr(ht, pic_obj_ptr(x)) != NULL) { return true; /* `x' was seen already. */ } else { - xh_put(ht, pic_obj_ptr(x), NULL); + xh_put_ptr(ht, pic_obj_ptr(x), NULL); } } } diff --git a/src/symbol.c b/src/symbol.c index 2ea530d5..10fd3822 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -20,13 +20,13 @@ pic_intern(pic_state *pic, const char *str, size_t len) cstr[len] = '\0'; memcpy(cstr, str, len); - e = xh_get(&pic->syms, cstr); + e = xh_get_str(&pic->syms, cstr); if (e) { return xh_val(e, pic_sym); } id = pic->sym_cnt++; - xh_put(&pic->syms, cstr, &id); + xh_put_str(&pic->syms, cstr, &id); xh_put_int(&pic->sym_names, id, &cstr); return id; } diff --git a/src/write.c b/src/write.c index 4122e600..bd13ac44 100644 --- a/src/write.c +++ b/src/write.c @@ -84,14 +84,14 @@ traverse_shared(struct writer_control *p, pic_value obj) switch (pic_type(obj)) { case PIC_TT_PAIR: case PIC_TT_VECTOR: - e = xh_get(&p->labels, pic_obj_ptr(obj)); + e = xh_get_ptr(&p->labels, pic_obj_ptr(obj)); if (e == NULL) { c = -1; - xh_put(&p->labels, pic_obj_ptr(obj), &c); + xh_put_ptr(&p->labels, pic_obj_ptr(obj), &c); } else if (xh_val(e, int) == -1) { c = p->cnt++; - xh_put(&p->labels, pic_obj_ptr(obj), &c); + xh_put_ptr(&p->labels, pic_obj_ptr(obj), &c); break; } else { @@ -130,17 +130,17 @@ write_pair(struct writer_control *p, struct pic_pair *pair) else if (pic_pair_p(pair->cdr)) { /* shared objects */ - if ((e = xh_get(&p->labels, pic_obj_ptr(pair->cdr))) && xh_val(e, int) != -1) { + if ((e = xh_get_ptr(&p->labels, pic_obj_ptr(pair->cdr))) && xh_val(e, int) != -1) { xfprintf(p->file, " . "); - if ((xh_get(&p->visited, pic_obj_ptr(pair->cdr)))) { + if ((xh_get_ptr(&p->visited, pic_obj_ptr(pair->cdr)))) { xfprintf(p->file, "#%d#", xh_val(e, int)); return; } else { xfprintf(p->file, "#%d=", xh_val(e, int)); c = 1; - xh_put(&p->visited, pic_obj_ptr(pair->cdr), &c); + xh_put_ptr(&p->visited, pic_obj_ptr(pair->cdr), &c); } } else { @@ -184,16 +184,16 @@ write_core(struct writer_control *p, pic_value obj) /* shared objects */ if (pic_vtype(obj) == PIC_VTYPE_HEAP - && (e = xh_get(&p->labels, pic_obj_ptr(obj))) + && (e = xh_get_ptr(&p->labels, pic_obj_ptr(obj))) && xh_val(e, int) != -1) { - if ((xh_get(&p->visited, pic_obj_ptr(obj)))) { + if ((xh_get_ptr(&p->visited, pic_obj_ptr(obj)))) { xfprintf(file, "#%d#", xh_val(e, int)); return; } else { xfprintf(file, "#%d=", xh_val(e, int)); c = 1; - xh_put(&p->visited, pic_obj_ptr(obj), &c); + xh_put_ptr(&p->visited, pic_obj_ptr(obj), &c); } }