From 6313cbdb1241796e4387794327e4727615d51c46 Mon Sep 17 00:00:00 2001 From: simonmar <unknown> Date: Wed, 26 Apr 2000 10:54:25 +0000 Subject: [PATCH] [project @ 2000-04-26 10:54:25 by simonmar] tidy up conditionals a bit. --- ghc/lib/std/PrelIO.lhs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ghc/lib/std/PrelIO.lhs b/ghc/lib/std/PrelIO.lhs index 65b4ca0a51e1..187653cb8452 100644 --- a/ghc/lib/std/PrelIO.lhs +++ b/ghc/lib/std/PrelIO.lhs @@ -421,9 +421,9 @@ commitAndReleaseBuffer hdl@(Handle h) buf sz count flush = do let ok h_ = putMVar h h_ >> return () -- enough room in handle buffer for the new data? - if (flush || fo_bufSize - fo_wptr - 1 < count) + if (flush || fo_bufSize - fo_wptr <= count) - -- The -1 is to be sure that we never exactly fill up the + -- The <= is to be sure that we never exactly fill up the -- buffer, which would require a flush. So if copying the -- new data into the buffer would make the buffer full, we -- just flush the existing buffer and the new data immediately, @@ -492,13 +492,13 @@ commitBuffer handle buf sz count flush = do fo_bufSize <- getBufSize fo new_wptr <- -- not enough room in handle buffer? - (if flush || (fo_bufSize - fo_wptr - 1 < count) + (if flush || (fo_bufSize - fo_wptr <= count) then do rc <- mayBlock fo (flushFile fo) if (rc < 0) then constructErrorAndFail "commitBuffer" else return 0 else return fo_wptr ) - if (flush || fo_bufSize - 1 < count) -- committed buffer too large? + if (flush || fo_bufSize <= count) -- committed buffer too large? then do rc <- write_buf fo buf count if (rc < 0) then constructErrorAndFail "commitBuffer" -- GitLab