1 patch for repository http://darcs.haskell.org/bytestring:

Wed Jun 20 12:22:32 EEST 2012  Lauri Alanko <la@iki.fi>
  * Add unsafePackMallocCStringLen

New patches:

[Add unsafePackMallocCStringLen
Lauri Alanko <la@iki.fi>**20120620092232
 Ignore-this: 2d16fea6dbfcee6245604acbe2a5c4dc
] {
hunk ./Data/ByteString/Unsafe.hs 39
         unsafePackCString,      -- :: CString -> IO ByteString
         unsafePackCStringLen,   -- :: CStringLen -> IO ByteString
         unsafePackMallocCString,-- :: CString -> IO ByteString
+        unsafePackMallocCStringLen, -- :: CStringLen -> IO ByteString
 
 #if defined(__GLASGOW_HASKELL__)
         unsafePackAddress,          -- :: Addr# -> IO ByteString
hunk ./Data/ByteString/Unsafe.hs 267
     len <- c_strlen cstr
     return $! PS fp 0 (fromIntegral len)
 
+-- | /O(n)/ Build a @ByteString@ from a malloced @CStringLen@. This
+-- value will have a @free(3)@ finalizer associated to it.
+--
+-- This funtion is /unsafe/. If the original @CString@ is later
+-- modified, this change will be reflected in the resulting @ByteString@,
+-- breaking referential transparency.
+--
+-- This function is also unsafe if you call its finalizer twice,
+-- which will result in a /double free/ error, or if you pass it
+-- a CString not allocated with 'malloc'.
+--
+unsafePackMallocCStringLen :: CStringLen -> IO ByteString
+unsafePackMallocCStringLen (cstr, len) = do
+    fp <- newForeignPtr c_free_finalizer (castPtr cstr)
+    return $! PS fp 0 len
+
 -- ---------------------------------------------------------------------
 
 -- | /O(1) construction/ Use a @ByteString@ with a function requiring a
}

Context:

[Add .gitignore file for GHC build.
p.capriotti@gmail.com**20120307153052
 Ignore-this: 755dcd78a9ec48b2ec2f3d98995b3a5f
] 
[Move __hscore_memcpy_src_off from base into include/fpstring.h
Ian Lynagh <igloo@earth.li>**20120222155246
 Ignore-this: f2f8fc7008f94e571ce78a33dfdb06f4
] 
[Allow using older versions of the random package
Duncan Coutts <duncan@community.haskell.org>**20111117011128
 Ignore-this: 8dc641a5670ab553609ad51796144713
] 
[Fix some more import warnings
Duncan Coutts <duncan@community.haskell.org>**20111117005928
 Ignore-this: dc08d7ddfd0af7f0d82b5a5c5132aaa3
] 
[Fix an issue with char/binary Handle write ordering with ghc-6.12
Duncan Coutts <duncan@community.haskell.org>**20111117005826
 Ignore-this: f4721f3f50380d4dc684d2ce21001d0f
 For 6.12 it needs an extra flushWriteBuffer.
] 
[Fixes for ghc-6.10
Duncan Coutts <duncan@community.haskell.org>**20111116233104
 Ignore-this: bc56311805eb0c66634d3284c6ab7d75
] 
[Make the testHandlePutBuilder conditional and add char8 version
Duncan Coutts <duncan@community.haskell.org>**20111116232920
 Ignore-this: 415dba7d9209cbb7f0620c74e5ec27aa
 The testHandlePutBuilder does not apply to older ghc with the pre-Unicode
 Handles. Extra char8 test covers old ghc and should work with new too.
] 
[Add implementation of builder internal hPut for old or non-ghc Handle
Duncan Coutts <duncan@community.haskell.org>**20111116232729
 Ignore-this: 56dacc6ed13971053e24dbf7c0e0004e
 The current hPut is specific to newer GHC with the new Unicode Handle
 stuff. Provide an implementation for older ghc and non-ghc compilers.
] 
[Fix building with ghc-7.3 and hopefully 7.4.x also
Duncan Coutts <duncan@community.haskell.org>**20111116220837
 Ignore-this: 5a5baec25bfcefb784e70176256a1937
 Based on a patch contributed by Herbert Valerio Riedel.
 Also fixes warnings for ghc-7.2.
] 
[Do not expose the BasicEncoding and other internals for this release
Duncan Coutts <duncan@community.haskell.org>**20111116204547
 Ignore-this: 3a0f545c399c44acf4bc07ed03e9db9
 We are being conservative here. There is useful functionality that we
 will want to expose somehow eventually, including the fixed and bounded
 size encodings for maximum speed of short encodings, plus the ability
 to do things like size-prefixed runs of data. However we will give
 ourselves some time to let this stuff settle down and a bit longer to
 think about the best way to support the more advanced & low-level bits.
] 
[port additional work on bytestring builder
Simon Meier <iridcode@gmail.com>**20111113230154
 Ignore-this: d9653d44e057498c62e61fd012c5e268
 
 This patch adds the remainder of the work I performed on the old bytestring
 repository. It adds the following changes:
 
 - Faster implementation of Float and Double serialization. We exploit that
   there is already a buffer that we can use to convert the Float to a Word32
   via the FFI.
 
 - Renaming of 'charASCII' and 'stringASCII' to 'char7' and 'string7': 
   The new names are easier to use (as they are shorter) and follow the
   same convention as the 'char8' versions.
 
 - Move of variable length encodings and the chunked and size-prefixed 
   builder transformers into a separate module:
 
     Data/ByteString/Lazy/Builder/BasicEncoding/Extras.hs
 
   The remainder of Data/ByteString/Lazy/Builder/BasicEncoding
   is now well-documentet and its API is considered stable.
 
 - Bugfixes to the size-prefixing builder transformer and a test case that
   caught the original bug.
 
 - The modules
 
     Data.ByteString.Lazy.Builder.Internal
     Data.ByteString.Lazy.Builder.BasicEncoding
     Data.ByteString.Lazy.Builder.BasicEncoding.Internal
     Data.ByteString.Lazy.Builder.BasicEncoding.Extras
 
   are now also exposed, but only
 
     Data.ByteString.Lazy.Builder.BasicEncoding
 
   is haddocked. They are required to provide transitional packages of
   blaze-html, blaze-builder, and blaze-enumerator based on the new
   bytestring builder.
 
] 
[Fix a few test failures due to incorrect Int64 -> Int conversion
Duncan Coutts <duncan@community.haskell.org>**20111115005203
 Ignore-this: 2abe2b578946bcb407b6b78b776e1d08
 Switch it around so we only promote Int -> Int64.
] 
[Add Simon's builder benchmark suite and add to .cabal file
Duncan Coutts <duncan@community.haskell.org>**20111113203741
 Ignore-this: 661887305b8b317cd9a0196a0e4decad
 Makes use of cabal's new support for benchmarks
] 
[Add missing extension
Duncan Coutts <duncan@community.haskell.org>**20111113203349
 Ignore-this: 59b1d1b93d4451270adbff6a85e4dbdf
] 
[Convert existing main test suite over to the minimal TestFramework code
Duncan Coutts <duncan@community.haskell.org>**20111113175155
 Ignore-this: 6081a3d02265d25c61a3bf5813d2a5ef
 This will make it easier to switch to the test-framework package later.
] 
[Make the builder test suite into a cabal test-suite
Duncan Coutts <duncan@community.haskell.org>**20111113174805
 Ignore-this: c8f2dab786e801a84f4e6fffb2b24bb5
 The advantage is it makes it easier to run automatically.
 The disadvantage is we cannot use the nice test-framework package since
 cabal then thinks we've got a circular dependency since test-framework
 indirectly depends on bytestring. This will be solvable in future with
 encapsulated package dependencies, but util then we use a minimal
 implementation of the bit of the test-framework that we're using.
] 
[Add the test suite for the builder monoid
Duncan Coutts <duncan@community.haskell.org>**20111113163022
 Ignore-this: 8cafd89cb45865dadee852a5433166e6
 Again, this is Simon Meier's code
] 
[Update docs for chunk size constants
Duncan Coutts <duncan@community.haskell.org>**20111113162612
 Ignore-this: 134635c118c3012135fbd01dbfdc69b1
] 
[Add new Builder monoid by Simon Meier
Duncan Coutts <duncan@community.haskell.org>**20111113162509
 Ignore-this: 1ad3cc5cbc8f84144a2c8b2c84d82ec7
 The design of strict and lazy ByteStrings makes concatenation expensive.
 A builder monoid lets us efficiently build bytestrings by sticking bits
 together in an ad-hoc way. For example by pretty-printing or
 serialising. This is as opposed to a uniform approach using unfoldr.
 
 This is the result of a lot of work over several years by several
 people. This new version is by Simon Meier. It was based on the version 
 by Jasper Van der Jeugt for the blaze-html library. The idea goes back
 further to the builder monoid in the binary library by Lennart Kolmodin
 and Ross Patterson. That was based on a builder monad by myself.
 The trick in all these designs is a continuation style monad/monoid for
 combining builders, and writing directly into buffers. The continuation
 trick allows it to be done in a non-persistent way, which in turn makes 
 possible to just write directly into buffers.
 
 Simon and Jasper's implementation follows the same general approach at
 the previous designs but achieves better performance by paying careful
 attention to low level details like buffer filling strategies and
 minimising the number of buffer bounds checks.
] 
[Added tests for toStrict and fromStrict
Duncan Coutts <duncan@community.haskell.org>**20111107124459
 Ignore-this: d0c7929a386034358915ecc790cb1b7a
] 
[Also export foldrChunks and foldlChunks
Duncan Coutts <duncan@community.haskell.org>**20111107124358
 Ignore-this: 94e856897ef7ab281f4eb670c9bdd2f4
 Along with fromStrict and toStrict we now match the Text API in this area.
] 
[Add conversion functions between lazy and (single) strict ByteStrings
Duncan Coutts <duncan@community.haskell.org>**20111107124352
 Ignore-this: 688da877749822671f3d4f19a18ed9d
 API proposal and initial patch by Herbert Valerio Riedel <hvr@gnu.org>
 http://article.gmane.org/gmane.comp.lang.haskell.libraries/16444
 More or less unanimous support.
 
 Don points out that he and I deliberately did not include these functions
 originally in an attempt to discourage people from converting back and forth
 since it is expensive to do so. Clearly people want these functions anyway.
 So instead I've added the following documentation to toStrict:
 
   Note that this is an /expensive/ operation that forces the whole lazy
   'ByteString' into memory and then copies all the data. If possible, try to
   avoid converting back and forth between strict and lazy bytestrings.
] 
[Fix documentation of complexity of toChunks
Duncan Coutts <duncan@community.haskell.org>**20111107124046
 Ignore-this: 855b8095c66933d4f3b362447a831c9c
] 
[Bump version to 0.10.0.0
Duncan Coutts <duncan@community.haskell.org>**20111107113626
 Ignore-this: 6ca32307604b4f606ec20787df181e19
 Some minor API changes and a number of extensions
] 
[Update module metadata and copyright info
Duncan Coutts <duncan@community.haskell.org>**20111107113610
 Ignore-this: 5333efad2ec1b1032d28968de5acfff
] 
[A few minor doc improvements
Duncan Coutts <duncan@community.haskell.org>**20111107113555
 Ignore-this: 417595713f2ea82a7fb77e813c01a36d
] 
[Update package description and tested-with list
Duncan Coutts <duncan@community.haskell.org>**20111107113533
 Ignore-this: 46fe8d73b4d6e7fcee82a60fb23ffa47
 Liberally borrowed the style of description from the text package.
] 
[Fix for ghc-6.8 / base-3
Duncan Coutts <duncan@community.haskell.org>**20111107113400
 Ignore-this: 9dc0838327115775cecb717ff5b48e3f
] 
[Fix warning about C FFI types
Duncan Coutts <duncan@community.haskell.org>**20111107113341
 Ignore-this: 79f8b5ccb46537808b79eb5e3fa624a
] 
[CPP-conditional LANGUAGE pragmas now work since ghc-7.0.x
Duncan Coutts <duncan@community.haskell.org>**20111107113315
 Ignore-this: 3a5ae0dc7e24c124954c2714d4e69c2
] 
[Fix implementation of Lazy.groupBy
Duncan Coutts <duncan@community.haskell.org>**20111107113212
 Ignore-this: 770b846bc6817876fab2126267823912
] 
[Clean up a few minor things in the test properties
Duncan Coutts <duncan@community.haskell.org>**20111107113128
 Ignore-this: 4e47064369d66b56503947220559b627
] 
[Add more extensive tests for the various new pack and unpack functions
Duncan Coutts <duncan@community.haskell.org>**20111107113107
 Ignore-this: a0b8335ef27279ca1e7ce66dc94fa62e
] 
[Include non-0 offset in instance Arbitrary Strict.ByteString
Duncan Coutts <duncan@community.haskell.org>**20111107113008
 Ignore-this: f7f8bf83f79368bc748f4e07cff6abc
 And fix a test that breaks.
] 
[Add tests for groupBy
Duncan Coutts <duncan@community.haskell.org>**20111107112900
 Ignore-this: a1e1619e572d8fe0db84e4d3bc0f3de3
 Note that it fails for Lazy.groupBy due to a chunk boundary bug.
] 
[Add BangPatterns extension
Duncan Coutts <duncan@community.haskell.org>**20111106194117
 Ignore-this: 239b498c92e32e592914d40c2e1f6187
] 
[Move Eq, Ord, Monoid instances to eliminate orphans
Duncan Coutts <duncan@community.haskell.org>**20111106192815
 Ignore-this: af00829573a746c18fd415c6454d0450
] 
[Use the new {un,}pack{Bytes,Chars} functions and simplify
Duncan Coutts <duncan@community.haskell.org>**20111106182800
 Ignore-this: 630dddaa4adaf3398c3a18eace92df4d
 We had a whole variety of odd pack/unpack functions. The nice thing is that
 with modern ghc we can use simpler implementations and get as good or better
 code than the old ones.
] 
[Drop unnecessary -funbox-strict-fields and set -fspec-constr-count
Duncan Coutts <duncan@community.haskell.org>**20111106181118
 Ignore-this: 8050eaefdafd298b1df338ff5880284e
 We use the UNPACK pragma explicitly in the couple places
 where we use strict fields.
] 
[Move the IsString instance so it is not an orphan
Duncan Coutts <duncan@community.haskell.org>**20111106180508
 Ignore-this: ca0582bb256102c9a3315313293dfd51
] 
[Add proper Data class instances that actually contain the data.
Duncan Coutts <duncan@community.haskell.org>**20111106175737
 Ignore-this: b4654ee840a451db339ed65023a811ec
 Same style as instances for Data.Text.
] 
[Add a proper Show and Read instance for lazy bytestrings
Duncan Coutts <duncan@community.haskell.org>**20111106165851
 Ignore-this: 9c3959d661a2d1192c075bf7eeab57dc
 Previous one was derived which was silly.
] 
[Add new internal list pack and unpack functions
Duncan Coutts <duncan@community.haskell.org>**20111106165316
 Ignore-this: 47f712808229c6253c62174e3450d73d
 Use them for the Show and Read instances.
 They should also be a tad better in terms of speed and memory use.
] 
[Remove unused fusion module
Duncan Coutts <duncan@community.haskell.org>**20111106001627
 Ignore-this: 4fa7b48fbf2d89acd2ed9dfc408dadfb
] 
[Fix test-suite and get rid of some warnings
Duncan Coutts <duncan@community.haskell.org>**20111105233537
 Ignore-this: 88f93c9517b8081ee6f24f4d3e7f5dc1
 Based on a patch by Bas van Dijk <v.dijk.bas@gmail.com>
] 
[Update cabal package metadata
Duncan Coutts <duncan@community.haskell.org>**20111105171754
 Ignore-this: ef6cf2e6d9cbf0c808ddb7d3052cf1ff
 Remove old homepage, add source repo and bug report addresses.
] 
[Add NFData instances for strict and lazy ByteStrings
Bas van Dijk <v.dijk.bas@gmail.com>**20111105165050
 Ignore-this: dc45153ceef774d3457118de44fa67e8
] 
[Throw exception in IO for functions in IO
Duncan Coutts <duncan@community.haskell.org>**20111105163259
 Ignore-this: e0ac1f69debe2e1295c20a4ca6d72c98
 Tracked down by Gershom Bazerman
] 
[Specify sensible fixities for cons and snoc
Duncan Coutts <duncan@community.haskell.org>**20111105151635
 Ignore-this: c6d764970b3922e09ca3b07898472ead
 As suggested by Yitzchak Gale.
] 
[Follow change to FFI decls: Import constructors of newtypes
Ian Lynagh <igloo@earth.li>**20111021002852
 Ignore-this: 6f44939dd54d5dd7ca5f0decc968063a
] 
[Use Safe Haskell if GHC >= 7.2
David Terei <davidterei@gmail.com>**20110809192450
 Ignore-this: 41e8f96f377740495943bd215d27a8a9
] 
[Remove old GHC flag from Cabal file
Ian Lynagh <igloo@earth.li>**20110704185011
 Ignore-this: de4da9ee1c3f1e369e7533428846dbaf
 
 The flag has been removed in GHC 7.3
] 
[Remove some old done TODO items
Duncan Coutts <duncan@community.haskell.org>**20110517135450
 Ignore-this: ae1fe46f268da4c840903814d9139c61
] 
[Update the test suite to QC2 and add a tests-suite stanza to the cabal file
Duncan Coutts <duncan@community.haskell.org>**20110517135110
 Ignore-this: 9ba994914ff9aebdf5db5d7e706453ac
 QC2 uses a rather different instance for Arbitrary Int which uses much
 bigger numbers than QC1 used. Some properties have had to be updated
 to use a smaller int range or they would take nearly forever to run.
] 
[Update maintainers' email addresses
Duncan Coutts <duncan@community.haskell.org>**20110517134332
 Ignore-this: ef4654d3424906be1f5a792950dbd156
] 
[Drop support for ghc-6.4 and 6.6
Duncan Coutts <duncan@community.haskell.org>**20110517112532
 Ignore-this: b8a978b2dd1d16c6f57f5f5094b59e4e
] 
[Bump minor version due to API additions
Duncan Coutts <duncan@community.haskell.org>**20110516122813
 Ignore-this: 34e61d06b93c76adb2b7d5905b838fe0
] 
[Export putStrLn and hPutStrLn from D.B.Lazy.Char8
Duncan Coutts <duncan@community.haskell.org>**20110516122624
 Ignore-this: 775831f2477cb3f69b9ebf806f45b26c
 and deprecate both functions in the non-Char8 modules.
 Functions that rely on ASCII encodings belong in the Char8 modules.
] 
[Add hPutNonBlocking
Duncan Coutts <duncan@community.haskell.org>**20110516115811
 Ignore-this: 2ec469780b26a86a7492dfc87b42caa7
 Based originally on a patch by David Fox <david.fox@linspire.com>
 Fixes ghc ticket #1070.
 Also update the documentation for hGetNonBlocking
] 
[Use explicit import list for GHC.IO to avoid build failure
Max Bolingbroke <atterseapower@hotmail.com>**20110514221755
 Ignore-this: c1825af0914b958099eda67ed583db50
] 
[Bump version number to 0.9.1.10
Ian Lynagh <igloo@earth.li>**20110107162327
 Ignore-this: 775963ffa10934c592060656106d502e
] 
[Make is build with nhc98.
Malcolm.Wallace@me.com**20110107142432] 
[TAG 0.9.1.9
Duncan Coutts <duncan@community.haskell.org>**20110106171112
 Ignore-this: 1aa3fd2d9d791b99bc4a36cea3862bb1
] 
Patch bundle hash:
e4b75d1055bd352248de7839b1ec7180db5cfb53