Ticket #3486: split-elems-fix.dpatch

File split-elems-fix.dpatch, 37.1 KB (added by duncan, 8 years ago)

Fix elemIndices and split

1Sat Sep 12 21:39:50 BST 2009  Duncan Coutts <duncan@haskell.org>
2  * Fix elemIndices and split
3  They were using inlinePerformIO to lazily delay IO actions within the
4  scope of a withForeignPtr. Thus the ptr was still in use after the
5  ForeignPtr went out of scope. This lead to dangling pointers, incorrect
6  results and segfaults. Nasty. See ghc tickets #3486 and #3487.
7  Audited the rest of the code base for the same anit-pattern.
8  Thanks to nwn and people on the haskell-jp mailing list for reporting
9  the bug with nice test cases and also to Ian, Bertram and Don for
10  diagnosing the source of the problem.
12New patches:
14[Fix elemIndices and split
15Duncan Coutts <duncan@haskell.org>**20090912203950
16 Ignore-this: 69ae945462b5638c99cc1824ed329e90
17 They were using inlinePerformIO to lazily delay IO actions within the
18 scope of a withForeignPtr. Thus the ptr was still in use after the
19 ForeignPtr went out of scope. This lead to dangling pointers, incorrect
20 results and segfaults. Nasty. See ghc tickets #3486 and #3487.
21 Audited the rest of the code base for the same anit-pattern.
22 Thanks to nwn and people on the haskell-jp mailing list for reporting
23 the bug with nice test cases and also to Ian, Bertram and Don for
24 diagnosing the source of the problem.
25] {
26hunk ./Data/ByteString.hs 1119
27 --
28 split :: Word8 -> ByteString -> [ByteString]
29 split _ (PS _ _ 0) = []
30-split w (PS x s l) = inlinePerformIO $ withForeignPtr x $ \p -> do
31-    let ptr = p `plusPtr` s
33+split w (PS x s l) = loop 0
34+    where
35         STRICT1(loop)
36         loop n =
37hunk ./Data/ByteString.hs 1123
38-            let q = inlinePerformIO $ memchr (ptr `plusPtr` n)
39-                                           w (fromIntegral (l-n))
40+            let q = inlinePerformIO $ withForeignPtr x $ \p ->
41+                      memchr (p `plusPtr` (s+n))
42+                             w (fromIntegral (l-n))
43             in if q == nullPtr
44                 then [PS x (s+n) (l-n)]
45hunk ./Data/ByteString.hs 1128
46-                else let i = q `minusPtr` ptr in PS x (s+n) (i-n) : loop (i+1)
47+                else let i = inlinePerformIO $ withForeignPtr x $ \p ->
48+                               return (q `minusPtr` (p `plusPtr` s))
49+                      in PS x (s+n) (i-n) : loop (i+1)
51hunk ./Data/ByteString.hs 1132
52-    return (loop 0)
53 {-# INLINE split #-}
55 {-
56hunk ./Data/ByteString.hs 1267
57 -- the indices of all elements equal to the query element, in ascending order.
58 -- This implementation uses memchr(3).
59 elemIndices :: Word8 -> ByteString -> [Int]
60-elemIndices w (PS x s l) = inlinePerformIO $ withForeignPtr x $ \p -> do
61-    let ptr = p `plusPtr` s
63+elemIndices w (PS x s l) = loop 0
64+    where
65         STRICT1(loop)
66hunk ./Data/ByteString.hs 1270
67-        loop n = let q = inlinePerformIO $ memchr (ptr `plusPtr` n)
68+        loop n = let q = inlinePerformIO $ withForeignPtr x $ \p ->
69+                           memchr (p `plusPtr` (n+s))
70                                                 w (fromIntegral (l - n))
71                  in if q == nullPtr
72                         then []
73hunk ./Data/ByteString.hs 1275
74-                        else let i = q `minusPtr` ptr
75+                        else let i = inlinePerformIO $ withForeignPtr x $ \p ->
76+                                       return (q `minusPtr` (p `plusPtr` s))
77                              in i : loop (i+1)
78hunk ./Data/ByteString.hs 1278
79-    return $! loop 0
80 {-# INLINE elemIndices #-}
82 {-
87[Update "tested-with" list
88Duncan Coutts <duncan@haskell.org>**20090823195516
89 Ignore-this: 873e64dd5c978cc12751d3b404e3619a
90 It builds with ghc-6.4 through to 6.11 (23/08/09)
91 It builds with no warnings with ghc 6.8, 6.10 and 6.11.
93[Clean up the language extension pragmas
94Duncan Coutts <duncan@haskell.org>**20090823194920
95 Ignore-this: c7fb9daf30b639d0bee909fd396de241
96 We cannot actually specify them correctly, see ghc ticket #3457.
97 We can at least simplify things and make it clear it does not work,
98 rather than having misleading code that looks like it might work.
100[Fix import warnings
101Duncan Coutts <duncan@haskell.org>**20090823194733
102 Ignore-this: 2db4b086627d428de7add92566df9eb
103 Patches merged from ghc's fork:
104   Tue Jul  7 12:58:17 BST 2009  Ian Lynagh <igloo@earth.li>
105     * Remove unused imports
107   Tue Jul  7 14:35:56 BST 2009  Ian Lynagh <igloo@earth.li>
108     * Fix unused import warnings
110   Wed Jul 22 13:56:04 BST 2009  Simon Marlow <marlowsd@gmail.com>
111     * fix compilation with GHC 6.10
113[Update for new IO library
114Duncan Coutts <duncan@haskell.org>**20090823175302
115 Ignore-this: 539da275e4528629baa6d9f66c2f3335
116 Merge of patch from ghc's fork:
117   Thu Jun 11 15:09:37 BST 2009  Simon Marlow <marlowsd@gmail.com>
118     * Update for new IO library
120[Fix "cabal check" warnings
121Duncan Coutts <duncan@haskell.org>**20090823145438
122 Ignore-this: f6a17b693d9216b840bf01cf55a2fa7d
123 Merge of patch from ghc's fork:
124   Tue Aug 11 22:58:58 BST 2009  Ian Lynagh <igloo@earth.li>
125     * Fix "Cabal check" warnings
127[Remove INLINE pragmas on recursive functions
128Duncan Coutts <duncan@haskell.org>**20090823145127
129 Ignore-this: 40b0b5e7a1c274b78231517736ab74c7
130 Merge of patch from ghc's fork:
131   Fri Dec  5 17:04:52 GMT 2008  simonpj@microsoft.com
132     * Remove INLINE pragmas on recursive functions
134     GHC now complains about INLINE pragmas on recursive functions,
135     and they were no-ops before in any case
137[Fix some "warn-unused-do-bind" warnings where we want to ignore the value
138Ian Lynagh <igloo@earth.li>**20090710202441]
139[Hide the .Internal modules in the haddock docs
140Duncan Coutts <duncan@haskell.org>**20090702000819
141 This should stop users accidentally using the semi-public
142 modules while still leaving them available for extension
143 packages. Also means that references to 'ByteString' go to
144 a sensible place rather than the .Internal modules.
146[Fix docs for unsafePackAddressLen, it doesn't need null-termination
147Duncan Coutts <duncan@haskell.org>**20090629192811]
148[Make docs for fromForeignPtr point to suitable public alternatives
149Duncan Coutts <duncan@haskell.org>**20090629191336]
150[Improve the top-level documentation for the Unsafe and Internal modules
151Duncan Coutts <duncan@haskell.org>**20090629191017
152 Clarify the purpose and properties of the functions in the two modules.
153 In particular try to disuade people from using the Internal functions
154 unnecessarily.
156[Use comma separated lists in the LANGUAGE pragmas
157Duncan Coutts <duncan@haskell.org>**20090629190950
158 Haddock complains.
160[bump versoin
161Don Stewart <dons@galois.com>**20090108182815]
162[Add a test for the laziness of readInt and readInteger over lazy ByteStrings
163Bryan O'Sullivan <bos@serpentine.com>**20081231070009]
164[Fix strictness bugs in readInt and readInteger.
165Bryan O'Sullivan <bos@serpentine.com>**20081231064853]
166[Add TODO item to eliminate -fno-warn-orphans
167Duncan Coutts <duncan@haskell.org>**20081101190200
168 Orphan instances in libraries are not a good thing.
170[Make everything build with ghc-6.6 and 6.4
171Duncan Coutts <duncan@haskell.org>**20081101190029
172 No code changes, just cpp for new LANGUAGE pragmas
173 and not using a RULE with a funky LHS for ghc-6.4 which didn't allow it.
175[avoid import renaming errors in nhc98
177[Import fix for nhc98
178Duncan Coutts <duncan@haskell.org>**20081006211934]
179[Bump version to
180Duncan Coutts <duncan@haskell.org>**20081006210002]
181[Drop dependency on syb with base 4
182Duncan Coutts <duncan@haskell.org>**20081006205908]
183[fix import of Control.Exception for nhc98
186Duncan Coutts <duncan@haskell.org>**20081004225748]
187[Bump version to
188Duncan Coutts <duncan@haskell.org>**20081004225716]
189[Whitespace changes to the package description
190Duncan Coutts <duncan@haskell.org>**20081004223529]
191[Drop -fglasgow-exts, use LANGUAGE pragmas
192Duncan Coutts <duncan@haskell.org>**20081004223518]
193[Build with both base-3 and 4
194Duncan Coutts <duncan@haskell.org>**20081004221008]
195[Drop unrecognised and unnecessary pragma
196Duncan Coutts <duncan@haskell.org>**20081004220034]
197[stupid ghc-prim
198Don Stewart <dons@galois.com>**20080825214146]
199[Only a minor version bump
200Don Stewart <dons@galois.com>**20080825205906]
201[clarify comments on hGet and EOF
202Don Stewart <dons@galois.com>**20080809233325]
203[typo in comment
204Don Stewart <dons@galois.com>**20080716181103]
205[notes, and undo -fcpr-off
206Don Stewart <dons@galois.com>**20080520001839]
207[clean up flags. building on 6.9
208Don Stewart <dons@galois.com>**20080519215317]
209[more aggressive inlining on lazy bytestring readInt. Performance wins for sum-file
210Don Stewart <dons@galois.com>**20080519215149]
211[make hackage happy
212Don Stewart <dons@galois.com>**20080420211741]
213[Point to HPC coverage data
214Don Stewart <dons@galois.com>**20080420210524]
216Don Stewart <dons@galois.com>**20080420205553]
217[Add properties for rewrite rules, compiled sans -fhpc
218Don Stewart <dons@galois.com>**20080419025720
220 Following an idea of Andy Gill's, compile just some rewrite rules code
221 without -fhpc, link it into a hpc app, and get coverage / rule firing
222 data for code run by rewrite rules. Library now 93% covered by QuickCheck.
225[fix warnings
226Don Stewart <dons@galois.com>**20080417232307]
227[Remove old fusion mechanism. Data.ByteString.Fusion is a place holder
228Don Stewart <dons@galois.com>**20080417230308
229 for streams now.
231 And while we're at it, reimplement mapAccumL/R and scanl
232 directly. Remove mapIndexed, as its trivial to write with mapAccumL.
235[more tests
236Don Stewart <dons@galois.com>**20080417162926]
237[tune deprecation string
238Don Stewart <dons@galois.com>**20080417162305]
239[some more tests
240Don Stewart <dons@galois.com>**20080417011226]
241[pointless filter rule
242Don Stewart <dons@galois.com>**20080417011025]
243[more QuickCheck properties, 88% covered now
244Don Stewart <dons@galois.com>**20080417010205]
245[Use -fglasgow-exts to re-enable rewrite rules
246Don Stewart <dons@galois.com>**20080417010144]
247[Remove obscure filter (==) rewrite rule
248Don Stewart <dons@galois.com>**20080417010057]
249[add a cunning test for packMallocCString
250Don Stewart <dons@galois.com>**20080416171625]
251[typos in comment
252Don Stewart <dons@galois.com>**20080416161143]
253[more testing
254Don Stewart <dons@galois.com>**20080414065202]
255[normalise rule names
256Don Stewart <dons@galois.com>**20080414064537]
257[More testing. 80% of bytestring is now tested with QuickCheck
258Don Stewart <dons@galois.com>**20080413221600]
260Don Stewart <dons@galois.com>**20080413190445]
261[More coverage
262Don Stewart <dons@galois.com>**20080413190419]
263[better clean target
264Don Stewart <dons@galois.com>**20080413135043]
265[tweak makefile
266Don Stewart <dons@galois.com>**20080413134800]
267[properties for breakSubstring
268Don Stewart <dons@galois.com>**20080413134635]
269[Add breakSubstring, split a bytestring on another bytestring. More idiomatic approach than findSubstring
270Don Stewart <dons@galois.com>**20080413134332]
271[faster findSubstrings
272Don Stewart <dons@galois.com>**20080413103033]
273[more tests
274Don Stewart <dons@galois.com>**20080413103014]
276Don Stewart <dons@galois.com>**20080413102931]
277[no longer depend on array
278Don Stewart <dons@galois.com>**20080413102910]
279[require Instances
280Don Stewart <dons@galois.com>**20080413102859]
281[add cheaper hpc test target
282Don Stewart <dons@galois.com>**20080413090044]
284Don Stewart <dons@galois.com>**20080413090026]
285[use "ByteString" prefix for rules
286Don Stewart <dons@galois.com>**20080413090006]
287[return failures
288Don Stewart <dons@galois.com>**20080413085955]
289[actually fail if tests don't pass
290Don Stewart <dons@galois.com>**20080413084834]
291[more test coverage
292Don Stewart <dons@galois.com>**20080412192702]
293[improve performance of findSubstrings on small strings
294Don Stewart <dons@galois.com>**20080412192633]
295[Use -fno-ignore-asserts when testing
296Don Stewart <dons@galois.com>**20080411160639]
297[coverage for Monoid instance
298Don Stewart <dons@galois.com>**20080411154716]
299[reuse internal invariant test
300Don Stewart <dons@galois.com>**20080411154700]
301[ghc uses -XUnliftedFFITypes -XMagicHash -XUnboxedTuples -XDeriveDataTypeable
302Don Stewart <dons@galois.com>**20080411154632]
303[use appropriate -X flags
304Don Stewart <dons@galois.com>**20080411144604]
305[bump version number
306Don Stewart <dons@galois.com>**20080411114047]
307[note how to run testsuite with hugs
308Don Stewart <dons@galois.com>**20080411114030]
309[document second argument of hGet
310Don Stewart <dons@galois.com>**20080406034554]
311[normalise rewrite rule names
312Don Stewart <dons@galois.com>**20080321165326]
314Don Stewart <dons@galois.com>**20080321005940]
315[standardise rule names with   "ByteString" prefix
316Don Stewart <dons@galois.com>**20080320204043]
317[standardise rules firing with prefix "ByteString"
318Don Stewart <dons@galois.com>**20080320170005]
319[dead code
320Don Stewart <dons@galois.com>**20080320165557]
321[Document IsString ByteString, and how to enable it
322Don Stewart <dons@galois.com>**20080320165445]
323[remove deprecated 'join' -- people should have transitioned to intercalate in the past 12 months
324Don Stewart <dons@galois.com>**20080320165136]
325[more tests
326Don Stewart <dons@galois.com>**20080318171700]
327[Add rewrite rule for Char8, matching the Word8 one, specialising break (==x)
328Don Stewart <dons@galois.com>**20080318171256]
329[erroneos inline [1] on Char8.dropWhile
330Don Stewart <dons@galois.com>**20080318170525]
331[portably use unsafeDupablePerformIO
332Don Stewart <dons@galois.com>**20080317014444]
333[respect warnings
334Don Stewart <dons@galois.com>**20080317012323]
335[clean up some things
336Don Stewart <dons@galois.com>**20080317011200]
337[Use unsafeDupablePerformIO as a cheaper unsafePerformIO, fixes stack overflow issues in stack squeezing cases
338Don Stewart <dons@galois.com>**20080314002323]
339[Documentations typos (filterByte instead of filterChar).
341[bump version
342Don Stewart <dons@galois.com>**20080222173300]
343[some tests on Ord speed
344Don Stewart <dons@galois.com>**20080221200459]
345[Remove pessimistic INLINE on compareBytes. 5x speedup for some Ord-heavy tests
346Don Stewart <dons@galois.com>**20080221200424]
347[typo in doc. spotted by Johan Tibell
348Don Stewart <dons@galois.com>**20080112222204]
349[todo, find the memcmp length threshodl
350Don Stewart <dons@galois.com>**20080109185141]
351[bump version
352Don Stewart <dons@galois.com>**20080105050338]
353[fix laziness issue with Lazy.lines
354Don Stewart <dons@galois.com>**20080105050319]
355[instance IsString for strict and lazy bytestrings. Use -XOverloadedStrings
356Don Stewart <dons@galois.com>**20080105045950]
357[note that Lazy.lines is too strict, and sketch lazy imlementation
358Don Stewart <dons@galois.com>**20080104000246]
359[bump version
360Don Stewart <dons@galois.com>**20071220073828]
362Don Stewart <dons@galois.com>**20071220073602]
363[complete test for resource leaks in getContents/readFile on both types
364Don Stewart <dons@galois.com>**20071220072847]
365[Don't hClose on getN functions -- they're not expected to read the whole file anyway
366Don Stewart <dons@galois.com>**20071220072010]
367[Remember to always hClose when doing a strict hGetContents. Avoids resource leaks.
368Don Stewart <dons@galois.com>**20071220071648]
369[add test for lazy hclose working
370Don Stewart <dons@galois.com>**20071220060736]
371[new email address
372Don Stewart <dons@galois.com>**20071220060644]
373[For lazy IO operations, be sure to hClose the resource on EOF
374Don Stewart <dons@galois.com>**20071220060613]
375[add isSpaceChar8, a good bit faster in tight inner loops
376Don Stewart <dons@galois.com>**20071216233315]
377[add category
378Don Stewart <dons@galois.com>**20071216230950]
379[TAG bytestring
380Don Stewart <dons@galois.com>**20071216230830]
381[update small test programs
382Don Stewart <dons@galois.com>**20071216230738]
383[keep haddock happy
384Don Stewart <dons@galois.com>**20071216225608]
385[no api changes, just perf improvments
386Don Stewart <dons@galois.com>**20071216224827]
387[Disable old array fusion mechanisms, was messing with the simplifier. Big perf improvements to lazy map/filter/fold
388Don Stewart <dons@galois.com>**20071216224036]
389[don't test unpack stuff
390Don Stewart <dons@galois.com>**20071216223808]
391[clean up some internals (docs, inlining)
392Don Stewart <dons@galois.com>**20071216205126]
393[move countOccurences out of .Internal
394Don Stewart <dons@galois.com>**20071216204424]
395[fix building of testsuite
396Don Stewart <dons@galois.com>**20071216202248]
397[update QC properties for 6.8
398Don Stewart <dons@galois.com>**20071216201021]
399[bump version number. import flags from ndp project
400Don Stewart <dons@galois.com>**20071216200912]
401[Documentation only: haddock the arguments and return values of fromForeignPtr and toForeignPtr.
403[typo in doc
404Don Stewart <dons@galois.com>**20071025155318]
405[TAG 0.9
406Duncan Coutts <duncan@haskell.org>**20071021115636]
407[Make it build with ghc-6.4 and 6.6
408Duncan Coutts <duncan@haskell.org>**20071017175845
409 The patch cannot be pushed to ghc-6.8's bytestring branch until ghc bootstraps
410 Cabal correctly, otherwise it trips up over the "cabal-version: >=1.2" field.
412[bytestring head depends on array
413Don Stewart <dons@galois.com>**20071006132955]
414[Comment out Cabal version check
415Ian Lynagh <igloo@earth.li>**20071005150733
416 This was causing the build to fail as Cabal didn't know its own version
417 number.
419[extra , at end of line not accepted by the head
420Don Stewart <dons@galois.com>**20070929200952]
421[Note that the ByteString searching api is about to be replaced
422Duncan Coutts <duncan@haskell.org>**20070928232147
423 So add a deprecated note to that effect to encourage people not to use them.
424 Besides, the current implementation is slower than a naive search.
426[Export isInfixOf from Data.ByteString.Char8
427Duncan Coutts <duncan@haskell.org>**20070928232026
428 It got added to Data.ByteString as an alias for isSubstringOf because
429 isInfixOf got added to Data.List
431[Haddock section header fixes, spelling, and trivial whitespace bits
432Duncan Coutts <duncan@haskell.org>**20070928231755
433 Section names and content should be more consistent between the modules now.
435[Use new style syntax in .cabal file and use configurations for ghc-6.4.2
436Duncan Coutts <duncan@haskell.org>**20070928223356
437 We previously had a comment saying what to change to get it to build with
438 older ghc versions. Now we can do it automatically with configurations.
440[Make it build with ghc-6.4.2
441Duncan Coutts <duncan@haskell.org>**20070928223330]
442[Add a boring file
443Ian Lynagh <igloo@earth.li>**20070913204646]
444[TAG ghc-6.8 branched 2007-09-03
445Ian Lynagh <igloo@earth.li>**20070903155552]
446[fix for Hugs: import internal newForeignPtr_
447Ross Paterson <ross@soi.city.ac.uk>**20070906221622
449 Don't know how nhc98 will handle this.
451[Export Fusion module, just for the sake of the testsuite
452Duncan Coutts <duncan@haskell.org>**20070906224412]
453[Remove one indirection in the representation of lazy ByteString
454Duncan Coutts <duncan@haskell.org>**20070906181142
455 Instead of:
456 newtype ByteString = LPS [S.ByteString]
457 we have:
458 data ByteString = Empty | Chunk {-# UNPACK #-} !S.ByteString ByteString
459 That is, the strict ByteString element is unpacked into the Chunk constructor
460 so it's now just one pointer to get to the data rather than having to look
461 up the S.ByteString cons element and then follow the pointer to the data.
462 Combined with SpecConstr we should be able to get some good speed improvements.
464[spell nhc98-options correctly
466[TAG 2007-09-05
467Ian Lynagh <igloo@earth.li>**20070905212625]
468[Move the fpstring.h to an include directory.
469Ian Lynagh <igloo@earth.li>**20070905160916]
470[Don't run the testsuite on commit, as it doesn't work
471Ian Lynagh <igloo@earth.li>**20070905160854]
472[Remove reference in docs to non-existant function tokens
473Duncan Coutts <duncan@haskell.org>**20070906180647]
474[Add a prologue.txt
475Ian Lynagh <igloo@earth.li>**20070829171829]
476[Add a dep on array
477Ian Lynagh <igloo@earth.li>**20070828225749]
478[Add naive implementations of Lazy.unzip and isSuffixOf
479Duncan Coutts <duncan@haskell.org>**20070829155615]
480[Add Lazy.hPutStr as compatibility alias for hPut
481Duncan Coutts <duncan@haskell.org>**20070829154934
482 To match api of strict module.
484[Export isInfixOf, alias for isSubstringOf
485Duncan Coutts <duncan@haskell.org>**20070829153303]
486[-Wall fix: don't import unsed thing
487Duncan Coutts <duncan@haskell.org>**20070829153233]
488[Add partition for strict and lazy
489Duncan Coutts <duncan@haskell.org>**20070829153129
490 Uses a simple implementation, we can optimise later.
491 Getting the api addition in now is the priority.
493[Add commented out exports for functions we're missing
494Duncan Coutts <duncan@haskell.org>**20070829152825
495 And change the formatting of some exports and docs of exported bits.
497[Remove hacks that are no longer necessary
498Duncan Coutts <duncan@haskell.org>**20070829152603
499 The simplifier no longer discards these I think.
501[Few updates to the README
502Duncan Coutts <duncan@haskell.org>**20070829152547]
503[Rarange modules in .cabal file
504Duncan Coutts <duncan@haskell.org>**20070829152421
505 Hide the .Fusion module so we can change it later without changing
506 the public api. Also, install the .h file.
508[Implement Lazy.groupBy
509Duncan Coutts <duncan@haskell.org>**20070829135113
510 Seems to pass the QC test.
512[Add Lazy.mapAccumR and reimplement mapAccumL
513Duncan Coutts <duncan@haskell.org>**20070829133508
514 including tests
516[Update the tests to work with module reorganisation
517Duncan Coutts <duncan@haskell.org>**20070829133401]
518[Add isInfixOf as an alias of isSubstringOf
519Duncan Coutts <duncan@haskell.org>**20070829132329
520 For api compatability with Data.List
522[Fix inlining of intercalate
523Duncan Coutts <duncan@haskell.org>**20070829132247
524 join was just the deprecated alias for the new intercalate
526[Fix Lazy.lines "foo\n\nbar"
527Duncan Coutts <duncan@haskell.org>**20070827152345]
528[Sort really does need allocaArray not allocaBytes
529Duncan Coutts <duncan@haskell.org>**20070827001615
530 Since it's an array of CSize not Word
531 Since it's an array of CSize not Word8. Fixes segfault.
533[Add Data.ByteString.Fusion to the cabal file
534Ian Lynagh <igloo@earth.li>**20070728214511]
535[Update copyright holders and add more metadata to .cabal file
536Duncan Coutts <duncan@haskell.org>**20070724173946]
537[Move some lazy ByteString internals into the .Lazy.Internal module
538Duncan Coutts <duncan@haskell.org>**20070623050245
539 This therefore exposes them in case people need them (eg binary, zlib).
540 It now exports the chunk size constants and the LPS data type invariant
541 and data abstraction functions.
543[update some todos
544Don Stewart <dons@cse.unsw.edu.au>**20070623033120]
545[Don't include undocumented functions into haddoc docs
546Duncan Coutts <duncan@haskell.org>**20070623043955
547 Use the #prune haddock module annotation. Move 'join' in export list to a
548 section with no header so we don't get an empty section where join used to be.
550[Rename join to intercalate to match the standard Data.List
551Duncan Coutts <duncan@haskell.org>**20070623043717
552 And implement Lazy.Char8 version of intersperse
554[Remove unnecessary import
555Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20070623025517]
556[Implement intersperse for lazy bytestring
557Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20070623025446]
558[Remove byteswap function
559Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20070623025303
560 It should not have been added in the first place. It's a fine function to
561 have  but not in the basic ByteString module which we should try and limit
562 to the list api.
564[Use the (re|m)allocBytes rather than (re|m)allocArray functions
565Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20070622063810
566 It's simpler and more direct, we are working with bytes here, not arrays.
567 And remove unused imports.
569[No longer need to ffi-import C's malloc and free
570Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20070622063504]
571[Eliminate newForeignFreePtr
572Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20070622063301
573 just inline its only use.
575[Fix use of free finaliser in hGetContents
576Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20070622062918
577 The memory was allocated with mallocBytes so it must be freed with free or
578 finalizerFree from the Foreign.Marshal.Alloc module. There is no guarantee
579 that this is the same as the C free function.
581[Change useAsCString so it does not use C malloc and free
582Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20070622062652
583 it was unnecessary
585[We no longer use instance of type synonym extension
586Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20070622050544]
587[Split .Internal module into .Unsafe and .Lazy.Internal
588Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20070621172546
589 The Unsafe module exports parts o the public API but that do unchecked things
590 like unsafe indexing, or things with CStrings that have side conditions.
591 But it doesn't really expose the internal representation, for example it does
592 not give away the fact that internally it uses ForeignPtrs.
593 The Internal module now just exports really internal things including the
594 representation, low level construction functions and utilities.
595 The representation of lazy ByteStrings is moved into it's own Internal module
596 which means we can call it ByteString without having to use a type alias.
597 That should make hugs and/or nhc a bit happier.
599[Move definition of empty from Internal to main ByteString module
600Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20070620173526
601 I can't recall why we moved it there in the first place,
602 but it's not necessary any more.
604[Rename .Base module to .Internal
605Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20070620172814]
606[also rename fps.cabal -> bytestring.cabal
607Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20070620171054]
608[Expect to use ghc-6.7 so no need for -DSLOW_FOREIGN_PTR
609Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20070620163724
610 and -funbox-strict-fields was never needed in the first place.
612[Change package name to bytestring
613Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20070620163522
614 and bump version number, and add myself as another author and maintainer
616[nhc98 needs extra stack to build for profiling
618[old nhc98 Makefiles now obsolete
620[Remove incorrectly typed commented out foreign imports
621Ian Lynagh <igloo@earth.li>**20070403194812]
622[Fix types of foreign imports
623Ian Lynagh <igloo@earth.li>**20070403194713]
624[append on lazy bytestrings is O(n/c) (just the inital spine is copied0
625Don Stewart <dons@cse.unsw.edu.au>**20070312122615]
626[nhc now has hGetBuf/hPutBuf
627Don Stewart <dons@cse.unsw.edu.au>**20070301094400]
628[Implement byteswapping, used for endian fiddling.
630 If the ByteString is going to end up being interpreted as a binary
631 representation of a sequence of 4-byte quantities (e.g. Float), then one
632 might need to change the endianness (byte ordering) of the
633 representation.  This patch adds the API call
634    byteswap :: ByteString -> ByteString
635 for such applications.  It assumes the bytestring will be a multiple of
636 4 in size.  (If not, the last n<4 bytes will be untouched.)  It also
637 assumes (without checking) that the start of the bytestring has the
638 correct alignment.
640[fps package needs extra stack to build (+ add D.BS.Char8)
642[need things from cbits directory for nhc98  build
644[Makefile build system for nhc98
646[headTail -> uncons
648[Define headTail :: ByteString -> Maybe (Word8, ByteString)
649Ian Lynagh <igloo@earth.li>**20070201161048]
650[Add complexity to Lazy.cons' docs
651Ian Lynagh <igloo@earth.li>**20070201155906]
652[Add cons' to Lazy.Char8 too
653Ian Lynagh <igloo@earth.li>**20070201155643]
654[Correct docs for Data.ByteString.Lazy.Char8.cons
655Ian Lynagh <igloo@earth.li>**20070201155054]
656[Make the lazy cons lazy, and add a cons' for when you want it to be strict
657Ian Lynagh <igloo@earth.li>**20070201140835]
658[comment only
659Don Stewart <dons@cse.unsw.edu.au>**20070213065321]
660[no boot-in-place
661Don Stewart <dons@cse.unsw.edu.au>**20070213065256]
662[adhering to agile principles, requiring a boot-in-place to run the tests on each commit is removed..
663Don Stewart <dons@cse.unsw.edu.au>**20070212004501]
665Don Stewart <dons@cse.unsw.edu.au>**20070212004317]
666[Make fromForeignPtr take the start so it is truly the inverse of toForeignPtr
667Ian Lynagh <igloo@earth.li>**20070202154627]
668[remove filterNotByte, and its rules. Its a rather pointless rule (filter -> filterNotByte -> filter)
669Don Stewart <dons@cse.unsw.edu.au>**20070205020018]
670[add iavor's CString test
671Don Stewart <dons@cse.unsw.edu.au>**20070130025217]
672[HEADS UP: Change CString api
673Don Stewart <dons@cse.unsw.edu.au>**20070130024408
675 Formerly, the CString api was very unsafe. The old api consisted of:
677     Zero-copying, efficient. Unsafe if you mutate the C string, in the
678     case of packMallocCString, if you run the finalisers twice:
680         packCString         :: CString -> ByteString
681         packCStringLen      :: CStringLen -> ByteString
682         packMallocCString   :: CString -> ByteString
683         useAsCStringLen     :: ByteString -> (CStringLen -> IO a) -> IO a
685     Safe. Copies the ByteString:
687         copyCString         :: CString -> IO ByteString
688         copyCStringLen      :: CStringLen -> IO ByteString
689         useAsCString        :: ByteString -> (CString -> IO a) -> IO a
692 Note that the default functions, packCString et al are fundamentally unsafe.
693 By modifying the CString (or Ptr) passed to them, it is possible to mutate the
694 ByteString, breaking referential transparency for pure Haskell code.
696 First step, move these functions into IO, and tag those that are unsafe with
697 the name 'unsafe'. Secondly, all unsafe* functions are moved into
698 Data.ByteString.Base.
700 The API is also sanitised a bit, becoming:
702 Data.ByteString:
704     packCString     :: CString    -> IO ByteString
705     packCStringLen  :: CStringLen -> IO ByteString
707     useAsCString    :: ByteString -> (CString    -> IO a) -> IO a
708     useAsCStringLen :: ByteString -> (CStringLen -> IO a) -> IO a
710 Safe, always copies to and from the CString*.
712 Dangerous, efficient api, suitable for constant CStrings only (and may have
713 other guarantees, such as null termination):
715     unsafeUseAsCString      :: ByteString -> (CString -> IO a) -> IO a
716     unsafeUseAsCStringLen   :: ByteString -> (CStringLen -> IO a) -> IO a
718     unsafePackCString       :: CString    -> IO ByteString
719     unsafePackCStringLen    :: CStringLen -> IO ByteString
720     unsafePackMallocCString :: CString    -> IO ByteString
722 Currently untested, though the code was only suffled around. All QC tests pass,
723 but they don't exercise the CString api.
727[Hide build noice when running tests
728Ian Lynagh <igloo@earth.li>**20070124162017]
729[Add lazybuild test
730Ian Lynagh <igloo@earth.li>**20070124161853]
731[Add a unit tests file, a test that append is lazy in the tail, and make it so.
732Ian Lynagh <igloo@earth.li>**20070124160043
733 Append was looking at the tails to see whether or not it was [], which forced
734 evaluation of the tail in situations where that is undesirable.
736[Test the library in-place rather than whatever is installed
737Ian Lynagh <igloo@earth.li>**20070124151123]
738[In teh testsuite, always pass the same GHC options, via ${GHCFLAGS}
739Ian Lynagh <igloo@earth.li>**20070124150146]
740[Fixups for building with nhc98 - inadvertently missed this file earlier.
743Don Stewart <dons@cse.unsw.edu.au>**20061203034405]
744[wibbles to fix ghc build
745Don Stewart <dons@cse.unsw.edu.au>**20061203033218]
746[workaround nhc98 import resolution bug for another module
748[Workaround for import resolution bug in nhc98.
750 Where there are multiple renamed imports:
751     import X as P
752     import Y as P
753     import Z as P
754 and they all export or re-export the same entity e, nhc98 does not seem
755 to be able to recognise that P.e is a unique entity, despite X.e, Y.e, and
756 Z.e all referring to the same thing.  This patch just introduces an extra
757 module name
758     import X as S
759 so that S.e is resolvable.
761[portability: give alternate import modules for nhc98
763[double check blank lines (since QC isn't generating them for us)
764Don Stewart <dons@cse.unsw.edu.au>**20061125064030]
765[remove a slighly suspicious use of unsafeCoerce#
766Don Stewart <dons@cse.unsw.edu.au>**20061120115933]
767[import portability fixes from Ross's base commits
768Don Stewart <dons@cse.unsw.edu.au>**20061110021347]
769[export the right 'cycle'
770Don Stewart <dons@cse.unsw.edu.au>**20061110014621]
771[make cons create 16 byte chunks instead of 17 byte chunks for lazy butestrings
772Bertram Felgenhauer <int-e@gmx.de>**20061007141231]
773[Fix lazyness of take, drop & splitAt.
774Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20061004111822
775 Spotted by Einar Karttunen. Thanks to him and to Bertram Felgenhauer
776 for explaining the problem and the fix to me.
778[fix hugs nice and good
779Don Stewart <dons@cse.unsw.edu.au>**20060909050020]
780[fix hugs
781Don Stewart <dons@cse.unsw.edu.au>**20060909045538]
782[and another tokens occurence
783Don Stewart <dons@cse.unsw.edu.au>**20060909044658]
784[remove tokens and mapAccumR from .Lazy
785Don Stewart <dons@cse.unsw.edu.au>**20060909044423]
786[remove leftover strictness annotations. they seemed to hurt more than help.
787Bertram Felgenhauer <int-e@gmx.de>**20060907212129]
788[add readInteger for *.Char8, and add appropriate quickcheck properties
789Bertram Felgenhauer <int-e@gmx.de>**20060907210243]
790[Fix type an implementation of toChunks.
791Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20060907182429
792 It should be returing a list of chunks! :-)
793 Spotted by int-e.
795[add fromChunks/toChunks
796Don Stewart <dons@cse.unsw.edu.au>**20060907083254]
797[Fix testsuite
798Don Stewart <dons@cse.unsw.edu.au>**20060907082136]
799[hide LPS constructor. move lazy bytestring defn in to .Base
800Don Stewart <dons@cse.unsw.edu.au>**20060907082102]
802Don Stewart <dons@cse.unsw.edu.au>**20060905020458]
803[hide internal module from haddock in Data.ByteString
804Don Stewart <dons@cse.unsw.edu.au>**20060828010842]
805[update Bench.hs to new api
806Don Stewart <dons@cse.unsw.edu.au>**20060824042140]
807[fusion wibbles
808Don Stewart <dons@cse.unsw.edu.au>**20060824040553]
809[more hugs fixes
810Don Stewart <dons@cse.unsw.edu.au>**20060823090814]
811[fix build for hugs
812Don Stewart <dons@cse.unsw.edu.au>**20060823090227]
813[Add rule for specialise dropWhile isSpace -> dropSpace
814Don Stewart <dons@cse.unsw.edu.au>**20060823080532]
815[add rules for break isSpace -> breakSpace
816Don Stewart <dons@cse.unsw.edu.au>**20060823075814]
817[propeties for the new rules
818Don Stewart <dons@cse.unsw.edu.au>**20060823075135]
819[rules for break/breakByte and span/spanByte
820Don Stewart <dons@cse.unsw.edu.au>**20060823073808]
821[rule for join -> joinByte
822Don Stewart <dons@cse.unsw.edu.au>**20060823071407]
823[good bye packWith/unpackWith
824Don Stewart <dons@cse.unsw.edu.au>**20060822153959]
825[No, I can't just merge createAndTrim straight from unstable
826Don Stewart <dons@cse.unsw.edu.au>**20060822151838]
827[no more tokens QC
828Don Stewart <dons@cse.unsw.edu.au>**20060822145445]
829[inline words, don't export hGet*N from .Lazy.Char8
830Don Stewart <dons@cse.unsw.edu.au>**20060822145337]
831[no more tokens
832Don Stewart <dons@cse.unsw.edu.au>**20060822144710]
833[hide hGet*N functions in .Lazy
834Don Stewart <dons@cse.unsw.edu.au>**20060822144158]
835[fix Properties.hs
836Don Stewart <dons@cse.unsw.edu.au>**20060822143005]
837[remove some bogus things done better with rules
838Don Stewart <dons@cse.unsw.edu.au>**20060822142305]
839[no more joinWithByte
840Don Stewart <dons@cse.unsw.edu.au>**20060822135841]
841[no more findIndexOrEnd exported
842Don Stewart <dons@cse.unsw.edu.au>**20060822135201]
843[Merge from the unstable branch. API mostly, and hGetSome story. Add fast 'empty()' while I'm here
844Don Stewart <dons@cse.unsw.edu.au>**20060822133026]
845[Rewrite some lazy consumers so they don't cause space leaks
846Duncan Coutts <duncan.coutts@worc.ox.ac.uk>**20060814020004]
847[lazy init isn't O(1), I think it should be O(n/c)
848Don Stewart <dons@cse.unsw.edu.au>**20060819042149]
851[comment out lengthU rules, now there's no lengthU
853[Add lazy-as-available byte strings
856 Lazy reading of network sockets is fantastic, but often you need to process
857 data as it's sent. Currently you can either set the block size to 1 byte or
858 you have to wait for an entire block to be read.
860 This adds the (terribly named) hGetSomeContentsN, which returns the contents
861 of a handle, lazily, but in a timely fashion.
865Don Stewart <dons@cse.unsw.edu.au>**20060812042644]
867Don Stewart <dons@cse.unsw.edu.au>**20060812042544]
868[Sync 0.8 and streams api
869Don Stewart <dons@cse.unsw.edu.au>**20060812042515]
870[comment out some tests we don't use now
871Don Stewart <dons@cse.unsw.edu.au>**20060812042504]
872[Encourage users to use -funbox-strict-fields
873Don Stewart <dons@cse.unsw.edu.au>**20060807042123]
874[remember that we still have to fix groupBy
875Don Stewart <dons@cse.unsw.edu.au>**20060804095000]
876[this is now the 0.8 branch
877Don Stewart <dons@cse.unsw.edu.au>**20060804093255]
878[add some missing functions to Char8
879Don Stewart <dons@cse.unsw.edu.au>**20060804093043]
881Don Stewart <dons@cse.unsw.edu.au>**20060804093009]
882[TAG 0.7
883Don Stewart <dons@cse.unsw.edu.au>**20060804090650]
884Patch bundle hash: