Ticket #1164: reversed-toGSList.dpatch

File reversed-toGSList.dpatch, 5.9 kB (added by guest, 5 years ago)

fix

Line 
1Thu May 14 13:29:33 BST 2009  m.niloc@gmail.com
2  * Fix Trac #1164. toGSList was reversing lists.
3
4New patches:
5
6[Fix Trac #1164. toGSList was reversing lists.
7m.niloc@gmail.com**20090514122933
8 Ignore-this: c466eadbc5ae61ba71721fe15b44735a
9] {
10hunk ./glib/System/Glib/GList.chs 45
11 
12 import Foreign
13 import Control.Exception       (bracket)
14+import Control.Monad           (foldM)
15 
16 {# context lib="glib" prefix="g" #}
17 
18hunk ./glib/System/Glib/GList.chs 117
19 -- Turn a list of something into a GList.
20 --
21 toGList :: [Ptr a] -> IO GList
22-toGList xs = makeList nullPtr xs
23+toGList = foldM prepend nullPtr . reverse
24   where
25hunk ./glib/System/Glib/GList.chs 119
26-    -- makeList :: GList -> [Ptr a] -> IO GList
27-    makeList current (x:xs) = do
28-      newHead <- {#call unsafe list_prepend#} current (castPtr x)
29-      makeList newHead xs
30-    makeList current [] = return current
31+    -- prepend :: GList -> Ptr a -> IO GList
32+    prepend l x = {#call unsafe list_prepend#} l (castPtr x)
33 
34 -- Turn a list of something into a GSList.
35 --
36hunk ./glib/System/Glib/GList.chs 125
37 toGSList :: [Ptr a] -> IO GSList
38-toGSList xs = makeList nullPtr xs
39+toGSList = foldM prepend nullPtr . reverse
40   where
41hunk ./glib/System/Glib/GList.chs 127
42-    -- makeList :: GSList -> [Ptr a] -> IO GSList
43-    makeList current (x:xs) = do
44-      newHead <- {#call unsafe slist_prepend#} current (castPtr x)
45-      makeList newHead xs
46-    makeList current [] = return current
47+    -- prepend :: GSList -> Ptr a -> IO GList
48+    prepend l x = {#call unsafe slist_prepend#} l (castPtr x)
49 
50 -- Temporarily allocate a list of something
51 --
52}
53
54Context:
55
56[Makefile.am: remove slashes after DESTDIR (fixes trac #1160)
57pgavin@gmail.com**20090510180614
58 Ignore-this: 5c57aa6375618d627e7568303a36abdd
59]
60[TAG 0.10.1
61pgavin@gmail.com**20090510160214]
62[configure.ac: bump version to 0.10.1
63pgavin@gmail.com**20090429032110
64 Ignore-this: 682c3f529251a07b3de0761729af5eeb
65]
66[Add missing export of Click(..) data type, repoted by Ben Franksen.
67Axel.Simon@ens.fr**20090509184414]
68[gtk/Graphics/UI/Gtk/General/Structs.hsc: Accept responses 0 and smaller than -11.
69Marco Túlio Gontijo e Silva <marcot@holoscopio.com>**20090507111848
70 Ignore-this: f64b69b52a743ac54b404452178b29c0
71]
72[Input method bindings
73m.niloc@gmail.com**20090504191302
74 Ignore-this: e8cbd55f0519ab413b24cae7b99d7b3d
75]
76[Improve apiGen names, for example hsv instead of hSV
77m.niloc@gmail.com**20090430152250
78 Ignore-this: 89e23bb8809006e40a3708049de9c031
79]
80[Bind GtkObject's destroy signal
81m.niloc@gmail.com**20090430152124
82 Ignore-this: b67612a0e13a5cabc2c3392cb78fadaf
83]
84[Add a function to insert the current clipboard content at the current cursor.
85Axel Simon <Axel.Simon@ens.fr>**20090424152430]
86[configure.ac: add bz2 dist tarball
87pgavin@gmail.com**20090429034820
88 Ignore-this: 5dfb2e2e91ab8b991d6908c7c08a51fe
89]
90[gtk: OwnerChange event only since gtk 2.6
91pgavin@gmail.com**20090429032134
92 Ignore-this: 23e3be727b8d43711321accaf35a4bf6
93]
94[Fix drawWindowGetPointer, trac #802.
95Axel.Simon@ens.fr**20090427194638]
96[Add an Eq instance for all objects.
97Axel.Simon@ens.fr**20090426153152
98 This patch makes it possible to use == to compare two objects or, rather,
99 their pointers. Since for one case an object is merely containing data
100 and has its own Eq instance, it was necessary to add a 'noEq' flag to
101 the type generator that, when given, prevents the generation of the
102 deriving Eq clause. This patch fixes trac #1158.
103]
104[New version of carsim demo
105mauricio.antunes@gmail.com**20090410234420
106 It has been a couple years since I wrote what is now the
107 'carsim' gtk2hs demo. I realized many of gtk+, gtk2hs and ghc
108 user library have been deprecated and replaced since then.
109 As it's in a demo directory, I thought it would be better to
110 have an updated version using current recomended API. Except
111 for a 'Pause' button, nothing important has changed in the user
112 interface. Changes in code include:
113 
114 - Deprecated code, like System.Time and a few of gtk2hs, has
115 been replaced.
116 
117 - Bug fix in about dialog.
118 
119 - Use of EventM.
120 
121 - Code is now UTF-8, but that only affects author name.
122 
123 - Hopefully, better code and documentation.
124]
125[gtk: allow zero as argument to toResponse in G.U.G.General.Structs
126pgavin@gmail.com**20090424152136
127 Ignore-this: 922761ff9383f47f6efc030377241316
128]
129[Unregister packages in reverse order to avoid dependency conflict.
130Axel Simon <Axel.Simon@ens.fr>**20090424144710]
131[Makefile.am: add package dependencies to haddock command line
132pgavin@gmail.com**20090424022757
133 Ignore-this: 4bbe2fde77816e01e7b8be81863cb234
134]
135[Correct arguments of a finally statement.
136Axel Simon <Axel.Simon@ens.fr>**20090417143511
137 This code has obviously never been tested. Thanks to Bertram Felgenhauer to spot this.
138]
139[Adapt demo to use new Exception module.
140Axel Simon <Axel.Simon@ens.fr>**20090417142437]
141[Add 'clean-all' option to tools/apiGen/Makefile
142mauricio.antunes@gmail.com**20090409024158
143 This adds a 'clean-all' option to apiGen's make
144 file. It will erase everything not on the original
145 distribution. This may be usefull if we are
146 testing different versions of packages, and need
147 to remove tarballs between tests.
148]
149[gio: Avoid calling (freeHaskellFunPtr nullFunPtr).
150Bertram Felgenhauer <int-e@gmx.de>**20090407084617]
151[Make explicit use of concurrent finalizers.
152Axel Simon <Axel.Simon@ens.fr>**20090327110603
153 This patch acounts for the change of semantics that finalizers undergo with
154 the release of GHC 6.10.1. Specifcially, finalizers are now by default
155 run during garbage collection, making it impossible to have them call back
156 to Haskell land. This patch uses functions that specifically schedule any
157 finilizers to be run as new threads once the mutator springs back to life.
158]
159[Add eventClick to EventM
160Hamish Mackenzie <hamish@firestream.co.uk>**20090307080530
161 Ignore-this: ff7b605b58d6021248f9951b4c641209
162]
163[Fix documentation.
164Axel.Simon@ens.fr**20090217180909]
165[TAG 0.10.0
166Peter Gavin <pgavin@gmail.com>**20090207054815]
167Patch bundle hash:
168cbf745437808bdebca70c559d2671aad85e0afd5