diff options
| author | simonmar <unknown> | 2000-04-26 10:54:25 +0000 |
|---|---|---|
| committer | simonmar <unknown> | 2000-04-26 10:54:25 +0000 |
| commit | 6313cbdb1241796e4387794327e4727615d51c46 (patch) | |
| tree | cc8c0dd92463cd02aa792c838cd93f175d0aa581 /ghc/lib/std/PrelIO.lhs | |
| parent | 42e01adfea287ed89f36c6641cc7437a7b8fe3aa (diff) | |
| download | haskell-6313cbdb1241796e4387794327e4727615d51c46.tar.gz | |
[project @ 2000-04-26 10:54:25 by simonmar]
tidy up conditionals a bit.
Diffstat (limited to 'ghc/lib/std/PrelIO.lhs')
| -rw-r--r-- | ghc/lib/std/PrelIO.lhs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ghc/lib/std/PrelIO.lhs b/ghc/lib/std/PrelIO.lhs index 65b4ca0a51..187653cb84 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" |
