remove unused guard clause

This commit is contained in:
Yuichi Nishiwaki 2014-07-19 12:18:23 +09:00
parent 619fe8e15e
commit e41cbc6f33
1 changed files with 3 additions and 9 deletions

View File

@ -41,19 +41,12 @@ internal_equal_p(pic_state *pic, pic_value x, pic_value y, size_t depth, xhash *
if (depth > 200) { if (depth > 200) {
pic_errorf(pic, "Stack overflow in equal\n"); pic_errorf(pic, "Stack overflow in equal\n");
} }
if (NULL == ht) { if (pic_pair_p(x) || pic_vec_p(x)) {
xh_init_ptr(ht, sizeof(void *));
}
switch (pic_type(x)) {
case PIC_TT_PAIR:
case PIC_TT_VECTOR:
if (xh_get(ht, pic_obj_ptr(x)) != NULL) { if (xh_get(ht, pic_obj_ptr(x)) != NULL) {
return true; /* `x' was seen already. */ return true; /* `x' was seen already. */
} else { } else {
xh_put(ht, pic_obj_ptr(x), NULL); xh_put(ht, pic_obj_ptr(x), NULL);
} }
default:
break;
} }
} }
@ -72,7 +65,7 @@ internal_equal_p(pic_state *pic, pic_value x, pic_value y, size_t depth, xhash *
case PIC_TT_BLOB: case PIC_TT_BLOB:
return blob_equal_p(pic_blob_ptr(x), pic_blob_ptr(y)); return blob_equal_p(pic_blob_ptr(x), pic_blob_ptr(y));
case PIC_TT_PAIR: case PIC_TT_PAIR: {
if (pic_nil_p(local)) { if (pic_nil_p(local)) {
local = x; local = x;
} }
@ -93,6 +86,7 @@ internal_equal_p(pic_state *pic, pic_value x, pic_value y, size_t depth, xhash *
} else { } else {
return false; return false;
} }
}
case PIC_TT_VECTOR: { case PIC_TT_VECTOR: {
size_t i; size_t i;
struct pic_vector *u, *v; struct pic_vector *u, *v;