diff options
-rw-r--r-- | compiler/GHC/Utils/Binary.hs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/compiler/GHC/Utils/Binary.hs b/compiler/GHC/Utils/Binary.hs index 08e54acbd5..36931b7b1f 100644 --- a/compiler/GHC/Utils/Binary.hs +++ b/compiler/GHC/Utils/Binary.hs @@ -169,15 +169,11 @@ setUserData :: BinHandle -> UserData -> BinHandle setUserData bh us = bh { bh_usr = us } -- | Get access to the underlying buffer. --- --- It is quite important that no references to the 'ByteString' leak out of the --- continuation lest terrible things happen. withBinBuffer :: BinHandle -> (ByteString -> IO a) -> IO a withBinBuffer (BinMem _ ix_r _ arr_r) action = do arr <- readIORef arr_r ix <- readFastMutInt ix_r - withForeignPtr arr $ \ptr -> - BS.unsafePackCStringLen (castPtr ptr, ix) >>= action + action $ BS.fromForeignPtr arr 0 ix --------------------------------------------------------------- |