diff dmd/Array.d @ 191:52188e7e3fb5

Fixed deprecated features, now compiles with DMD2.058 Also changed Array allocation policy: Now doesn't reallocate but malloc's, followed by a memcpy (no free). (this fixes a crash while compiling druntime. Same bug in dmd)
author korDen@korDen-pc
date Sun, 25 Mar 2012 03:11:12 +0400
parents e3afd1303184
children
line wrap: on
line diff
--- a/dmd/Array.d	Sun Mar 25 01:39:46 2012 +0400
+++ b/dmd/Array.d	Sun Mar 25 03:11:12 2012 +0400
@@ -67,7 +67,13 @@
 		//printf("Array::reserve: size = %d, offset = %d, nbytes = %d\n", size, offset, nbytes);
 		if (allocdim - dim < nentries) {
 			allocdim = dim + nentries;
-			data = cast(void**)GC.realloc(data, allocdim * (*data).sizeof);
+			
+			auto newData = cast(void**)GC.malloc(allocdim * (*data).sizeof);
+			memcpy(newData, data, dim * (*data).sizeof);
+//			GC.free(data);
+			data = newData;
+			
+			//data = cast(void**)GC.realloc(data, allocdim * (*data).sizeof);
 		}
 	}