cleanup pic_read

This commit is contained in:
Yuichi Nishiwaki 2015-06-29 02:04:55 +09:00
parent 5138ab4a8c
commit f6a727beb4
1 changed files with 8 additions and 11 deletions

View File

@ -857,23 +857,20 @@ pic_read(pic_state *pic, struct pic_port *port)
{ {
size_t ai = pic_gc_arena_preserve(pic); size_t ai = pic_gc_arena_preserve(pic);
pic_value val; pic_value val;
int c = next(pic, port); int c;
retry: while ((c = skip(pic, port, next(pic, port))) != EOF) {
c = skip(pic, port, c); val = read_nullable(pic, port, c);
if (! pic_invalid_p(val)) {
break;
}
pic_gc_arena_restore(pic, ai);
}
if (c == EOF) { if (c == EOF) {
return pic_eof_object(); return pic_eof_object();
} }
val = read_nullable(pic, port, c);
if (pic_invalid_p(val)) {
c = next(pic, port);
pic_gc_arena_restore(pic, ai);
goto retry;
}
pic_gc_arena_restore(pic, ai); pic_gc_arena_restore(pic, ai);
return pic_gc_protect(pic, val); return pic_gc_protect(pic, val);
} }