Ticket #1903: container.patch
| File container.patch, 1.6 kB (added by dhasenan, 2 years ago) |
|---|
nyu nyu-nyu! |
-
Container.d
old new 129 129 T*[] allocate (size_t count) 130 130 { 131 131 auto p = (cast(T**) calloc(count, (T*).sizeof)) [0 .. count]; 132 GC.addR oot (cast(void*) p);132 GC.addRange (cast(void*) p, count * (T*).sizeof); 133 133 return p; 134 134 } 135 135 … … 143 143 { 144 144 if (t.ptr) 145 145 { 146 GC.removeR oot(t.ptr);146 GC.removeRange (t.ptr); 147 147 free (t.ptr); 148 148 } 149 149 } … … 180 180 { 181 181 foreach (ref list; lists) 182 182 { 183 GC.removeR oot(list.ptr);183 GC.removeRange (list.ptr); 184 184 free (list.ptr); 185 185 list = null; 186 186 } … … 216 216 lists.length = lists.length + 1; 217 217 auto p = (cast(T*) calloc (chunks, T.sizeof)) [0 .. chunks]; 218 218 lists[$-1] = p; 219 GC.addR oot (p.ptr);219 GC.addRange (p.ptr, T.sizeof * chunks); 220 220 auto head = cache; 221 221 foreach (ref node; p) 222 222 {










