projects
/
ghc-base.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tweak the BufferedIO class to enable a memory-mapped file implementation
[ghc-base.git]
/
GHC
/
IO
/
Handle
/
Internals.hs
diff --git
a/GHC/IO/Handle/Internals.hs
b/GHC/IO/Handle/Internals.hs
index
0de07f4
..
403407f
100644
(file)
--- a/
GHC/IO/Handle/Internals.hs
+++ b/
GHC/IO/Handle/Internals.hs
@@
-205,7
+205,8
@@
checkWritableHandle act h_@Handle__{..}
buf <- readIORef haCharBuffer
writeIORef haCharBuffer buf{ bufState = WriteBuffer }
buf <- readIORef haByteBuffer
buf <- readIORef haCharBuffer
writeIORef haCharBuffer buf{ bufState = WriteBuffer }
buf <- readIORef haByteBuffer
- writeIORef haByteBuffer buf{ bufState = WriteBuffer }
+ buf' <- Buffered.emptyWriteBuffer haDevice buf
+ writeIORef haByteBuffer buf'
act h_
_other -> act h_
act h_
_other -> act h_
@@
-705,8
+706,8
@@
writeTextDevice h_@Handle__{..} cbuf = do
debugIO ("writeTextDevice after encoding: cbuf=" ++ summaryBuffer cbuf' ++
" bbuf=" ++ summaryBuffer bbuf')
debugIO ("writeTextDevice after encoding: cbuf=" ++ summaryBuffer cbuf' ++
" bbuf=" ++ summaryBuffer bbuf')
- Buffered.flushWriteBuffer haDevice bbuf'
- writeIORef haByteBuffer bbuf{bufL=0,bufR=0}
+ bbuf' <- Buffered.flushWriteBuffer haDevice bbuf'
+ writeIORef haByteBuffer bbuf'
if not (isEmptyBuffer cbuf')
then writeTextDevice h_ cbuf'
else return ()
if not (isEmptyBuffer cbuf')
then writeTextDevice h_ cbuf'
else return ()