From d6b66a32fd58242ba097132acaffdf7a3442bf18 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Tue, 12 May 2015 07:30:44 +0900 Subject: [PATCH] Reduce the number of calls to fcntl in sexp_read. --- sexp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sexp.c b/sexp.c index 866efcd0..db93ac3c 100644 --- a/sexp.c +++ b/sexp.c @@ -2788,7 +2788,6 @@ sexp sexp_read_raw (sexp ctx, sexp in) { int c1, c2, line; sexp tmp2; sexp_gc_var2(res, tmp); - sexp_check_block_port(ctx, in, 0); sexp_gc_preserve2(ctx, res, tmp); scan_loop: @@ -3252,7 +3251,6 @@ sexp sexp_read_raw (sexp ctx, sexp in) { if (sexp_port_sourcep(in) && sexp_pointerp(res)) sexp_immutablep(res) = 1; - sexp_maybe_unblock_port(ctx, in); sexp_gc_release2(ctx); return res; } @@ -3260,6 +3258,7 @@ sexp sexp_read_raw (sexp ctx, sexp in) { sexp sexp_read_op (sexp ctx, sexp self, sexp_sint_t n, sexp in) { sexp res; sexp_assert_type(ctx, sexp_iportp, SEXP_IPORT, in); + sexp_check_block_port(ctx, in, 0); res = sexp_read_raw(ctx, in); if (res == SEXP_CLOSE) res = sexp_read_error(ctx, "too many ')'s", SEXP_NULL, in); @@ -3269,6 +3268,7 @@ sexp sexp_read_op (sexp ctx, sexp self, sexp_sint_t n, sexp in) { #endif else if (res == SEXP_RAWDOT) res = sexp_read_error(ctx, "unexpected '.'", SEXP_NULL, in); + sexp_maybe_unblock_port(ctx, in); return res; }