Commit 80a3a156 authored by ian@well-typed.com's avatar ian@well-typed.com
Browse files

Remove a couple more FastBytes functions

parent 3c171430
...@@ -470,7 +470,7 @@ Hash values should be zero or a positive integer. No negatives please. ...@@ -470,7 +470,7 @@ Hash values should be zero or a positive integer. No negatives please.
\begin{code} \begin{code}
hashLiteral :: Literal -> Int hashLiteral :: Literal -> Int
hashLiteral (MachChar c) = ord c + 1000 -- Keep it out of range of common ints hashLiteral (MachChar c) = ord c + 1000 -- Keep it out of range of common ints
hashLiteral (MachStr s) = hashFB s hashLiteral (MachStr s) = hashByteString s
hashLiteral (MachNullAddr) = 0 hashLiteral (MachNullAddr) = 0
hashLiteral (MachInt i) = hashInteger i hashLiteral (MachInt i) = hashInteger i
hashLiteral (MachInt64 i) = hashInteger i hashLiteral (MachInt64 i) = hashInteger i
......
...@@ -33,7 +33,7 @@ module FastString ...@@ -33,7 +33,7 @@ module FastString
fastStringToFastBytes, fastStringToFastBytes,
fastZStringToByteString, fastZStringToByteString,
unsafeMkFastBytesString, unsafeMkFastBytesString,
hashFB, hashByteString,
-- * FastZString -- * FastZString
FastZString, FastZString,
...@@ -162,14 +162,11 @@ pokeCAString ptr str = ...@@ -162,14 +162,11 @@ pokeCAString ptr str =
in in
go str 0 go str 0
hashFB :: FastBytes -> Int hashByteString :: ByteString -> Int
hashFB bs hashByteString bs
= inlinePerformIO $ BS.unsafeUseAsCStringLen bs $ \(ptr, len) -> = inlinePerformIO $ BS.unsafeUseAsCStringLen bs $ \(ptr, len) ->
return $ hashStr (castPtr ptr) len return $ hashStr (castPtr ptr) len
hPutFB :: Handle -> FastBytes -> IO ()
hPutFB = BS.hPut
-- ----------------------------------------------------------------------------- -- -----------------------------------------------------------------------------
newtype FastZString = FastZString ByteString newtype FastZString = FastZString ByteString
...@@ -515,7 +512,7 @@ getFastStringTable = do ...@@ -515,7 +512,7 @@ getFastStringTable = do
-- |Outputs a 'FastString' with /no decoding at all/, that is, you -- |Outputs a 'FastString' with /no decoding at all/, that is, you
-- get the actual bytes in the 'FastString' written to the 'Handle'. -- get the actual bytes in the 'FastString' written to the 'Handle'.
hPutFS :: Handle -> FastString -> IO () hPutFS :: Handle -> FastString -> IO ()
hPutFS handle fs = hPutFB handle $ fastStringToFastBytes fs hPutFS handle fs = BS.hPut handle $ fastStringToFastBytes fs
-- ToDo: we'll probably want an hPutFSLocal, or something, to output -- ToDo: we'll probably want an hPutFSLocal, or something, to output
-- in the current locale's encoding (for error messages and suchlike). -- in the current locale's encoding (for error messages and suchlike).
......
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