Commit 37983d3e authored by Lennart Kolmodin's avatar Lennart Kolmodin
Browse files

Use accursedUnutterablePerformIO rather than inlinePerformIO.

Let's share the address space with a malevolent agent of chaos.
parent ff7239ca
......@@ -41,7 +41,8 @@ library
Data.Binary.Builder.Internal
other-modules: Data.Binary.Builder.Base,
Data.Binary.Class
Data.Binary.Class,
Data.Binary.Internal
if impl(ghc >= 7.2.1)
cpp-options: -DGENERICS
......
......@@ -74,7 +74,7 @@ import Foreign
import System.IO.Unsafe as IO ( unsafePerformIO )
import Data.ByteString.Internal (inlinePerformIO)
import Data.Binary.Internal ( accursedUnutterablePerformIO )
import qualified Data.ByteString.Internal as S
import qualified Data.ByteString.Lazy.Internal as L
......@@ -198,7 +198,7 @@ flush = Builder $ \ k buf@(Buffer p o u l) ->
then k buf
else let !b = Buffer p (o+u) 0 l
!bs = S.PS p o u
in return $! L.Chunk bs (inlinePerformIO (k b))
in return $! L.Chunk bs (accursedUnutterablePerformIO (k b))
{-# INLINE [0] flush #-}
------------------------------------------------------------------------
......
......@@ -44,12 +44,13 @@ module Data.Binary.Get.Internal (
import Foreign
import qualified Data.ByteString as B
import qualified Data.ByteString.Internal as B
import qualified Data.ByteString.Unsafe as B
import Control.Applicative
import Control.Monad
import Data.Binary.Internal ( accursedUnutterablePerformIO )
#if __GLASGOW_HASKELL__ < 704 && !defined(__HADDOCK__)
-- needed for (# unboxing #) with magic hash
-- Do we still need these? Works without on modern GHCs.
......@@ -415,5 +416,5 @@ unsafeReadN !n f = C $ \inp ks -> do
readNWith :: Int -> (Ptr a -> IO a) -> Get a
readNWith n f = do
readN n $ \s -> B.inlinePerformIO $ B.unsafeUseAsCString s (f . castPtr)
readN n $ \s -> accursedUnutterablePerformIO $ B.unsafeUseAsCString s (f . castPtr)
{-# INLINE readNWith #-}
{-# LANGUAGE CPP #-}
module Data.Binary.Internal
( accursedUnutterablePerformIO ) where
#if MIN_VERSION_bytestring(0,10,6)
import Data.ByteString.Internal( accursedUnutterablePerformIO )
#else
import Data.ByteString.Internal( inlinePerformIO )
{-# INLINE accursedUnutterablePerformIO #-}
-- | You must be truly desperate to come to me for help.
accursedUnutterablePerformIO :: IO a -> a
accursedUnutterablePerformIO = inlinePerformIO
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment