pic_length is now unsafe to circular list

This commit is contained in:
Yuichi Nishiwaki 2014-03-16 23:13:03 +09:00
parent 8598042deb
commit 00d92c79bf
1 changed files with 4 additions and 0 deletions

View File

@ -177,6 +177,10 @@ pic_length(pic_state *pic, pic_value obj)
{
int c = 0;
if (! pic_list_p(obj)) {
pic_errorf(pic, "length: expected list, but got ~s", obj);
}
while (! pic_nil_p(obj)) {
obj = pic_cdr(pic, obj);
++c;