Joey You seem to be doing great things, thank you!
Can I urge you to adopt the "Note [blah]" comment style described here? http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle I find that pretty much *whenever* I fix a bug, it's a good plan to add a "Note [blah]" comment to explain the reasoning. After all, I got it wrong the first time. For example in you patch below, why do you use memmove instead of memcopy? (Don't tell me by way of reply; instead add a comment that explains.) I can't tell you how often these comments have saved me when I look at that code again two years later! Thanks Simon | -----Original Message----- | From: cvs-libraries-boun...@haskell.org [mailto:cvs-libraries- | boun...@haskell.org] On Behalf Of Joey Adams | Sent: 28 December 2012 18:12 | To: cvs-librar...@haskell.org | Subject: [commit: base] master: GHC.IO.Buffer: use memmove instead of | memcpy in slideContents (cb6f03d) | | Repository : ssh://darcs.haskell.org//srv/darcs/packages/base | | On branch : master | | http://hackage.haskell.org/trac/ghc/changeset/cb6f03db3e0df85b47bb6086728cd | 51d982a46b9 | | >--------------------------------------------------------------- | | commit cb6f03db3e0df85b47bb6086728cd51d982a46b9 | Author: Joey Adams <joeyadams3.14...@gmail.com> | Date: Mon Dec 24 12:42:01 2012 -0500 | | GHC.IO.Buffer: use memmove instead of memcpy in slideContents | | >--------------------------------------------------------------- | | GHC/IO/Buffer.hs | 6 +++--- | 1 files changed, 3 insertions(+), 3 deletions(-) | | diff --git a/GHC/IO/Buffer.hs b/GHC/IO/Buffer.hs | index 8f677f0..eb46eb1 100644 | --- a/GHC/IO/Buffer.hs | +++ b/GHC/IO/Buffer.hs | @@ -256,12 +256,12 @@ slideContents :: Buffer Word8 -> IO (Buffer Word8) | slideContents buf@Buffer{ bufL=l, bufR=r, bufRaw=raw } = do | let elems = r - l | withRawBuffer raw $ \p -> | - do _ <- memcpy p (p `plusPtr` l) (fromIntegral elems) | + do _ <- memmove p (p `plusPtr` l) (fromIntegral elems) | return () | return buf{ bufL=0, bufR=elems } | | -foreign import ccall unsafe "memcpy" | - memcpy :: Ptr a -> Ptr a -> CSize -> IO (Ptr ()) | +foreign import ccall unsafe "memmove" | + memmove :: Ptr a -> Ptr a -> CSize -> IO (Ptr a) | | summaryBuffer :: Buffer a -> String | summaryBuffer buf = "buf" ++ show (bufSize buf) ++ "(" ++ show (bufL buf) | ++ "-" ++ show (bufR buf) ++ ")" | | | | _______________________________________________ | Cvs-libraries mailing list | cvs-librar...@haskell.org | http://www.haskell.org/mailman/listinfo/cvs-libraries _______________________________________________ Cvs-ghc mailing list Cvs-ghc@haskell.org http://www.haskell.org/mailman/listinfo/cvs-ghc