diff options
author | Sylvain Henry <hsyl20@gmail.com> | 2018-11-22 11:31:16 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-11-22 12:11:15 -0500 |
commit | 13bb4bf44e6e690133be334bbf0c63fcae5db34a (patch) | |
tree | ee7a9a9f60ca936b16cc15a46c758d4dc51abfd7 /compiler/utils/BufWrite.hs | |
parent | f5fbecc85967218fd8ba6512f10eea2daf2812ac (diff) | |
download | haskell-13bb4bf44e6e690133be334bbf0c63fcae5db34a.tar.gz |
Rename literal constructors
In a previous patch we replaced some built-in literal constructors
(MachInt, MachWord, etc.) with a single LitNumber constructor.
In this patch we replace the `Mach` prefix of the remaining constructors
with `Lit` for consistency (e.g., LitChar, LitLabel, etc.).
Sadly the name `LitString` was already taken for a kind of FastString
and it would become misleading to have both `LitStr` (literal
constructor renamed after `MachStr`) and `LitString` (FastString
variant). Hence this patch renames the FastString variant `PtrString`
(which is more accurate) and the literal string constructor now uses the
least surprising `LitString` name.
Both `Literal` and `LitString/PtrString` have recently seen breaking
changes so doing this kind of renaming now shouldn't harm much.
Reviewers: hvr, goldfire, bgamari, simonmar, jrtc27, tdammers
Subscribers: tdammers, rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4881
Diffstat (limited to 'compiler/utils/BufWrite.hs')
-rw-r--r-- | compiler/utils/BufWrite.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/utils/BufWrite.hs b/compiler/utils/BufWrite.hs index 99c043ce41..f4b406fe90 100644 --- a/compiler/utils/BufWrite.hs +++ b/compiler/utils/BufWrite.hs @@ -19,7 +19,7 @@ module BufWrite ( bPutStr, bPutFS, bPutFZS, - bPutLitString, + bPutPtrString, bPutReplicate, bFlush, ) where @@ -98,15 +98,15 @@ bPutCStringLen b@(BufHandle buf r hdl) cstr@(ptr, len) = do copyBytes (buf `plusPtr` i) ptr len writeFastMutInt r (i + len) -bPutLitString :: BufHandle -> LitString -> IO () -bPutLitString b@(BufHandle buf r hdl) l@(LitString a len) = l `seq` do +bPutPtrString :: BufHandle -> PtrString -> IO () +bPutPtrString b@(BufHandle buf r hdl) l@(PtrString a len) = l `seq` do i <- readFastMutInt r if (i+len) >= buf_size then do hPutBuf hdl buf i writeFastMutInt r 0 if (len >= buf_size) then hPutBuf hdl a len - else bPutLitString b l + else bPutPtrString b l else do copyBytes (buf `plusPtr` i) a len writeFastMutInt r (i+len) |