Mercurial > projects > ddmd
diff dmd/Array.d @ 2:7427ded8caf7
Removed unreferenced modules
First step at fixing GC issues - now calling GC.malloc instead of malloc (ditto calloc and realloc), get rid of free
author | korDen |
---|---|
date | Sun, 25 Oct 2009 03:20:59 +0300 |
parents | 10317f0c89a5 |
children | d706d958e4e8 |
line wrap: on
line diff
--- a/dmd/Array.d Sat Oct 24 17:25:59 2009 +0400 +++ b/dmd/Array.d Sun Oct 25 03:20:59 2009 +0300 @@ -1,8 +1,10 @@ module dmd.Array; +import dmd.Memory; + import std.contracts; +import core.stdc.string; import core.stdc.stdlib; -import core.stdc.string; class Array { @@ -13,7 +15,6 @@ ~this() { ///mem.free(data); - free(data); } void mark() @@ -36,7 +37,7 @@ len += buf[u].length + 1; } - char* str = cast(char*)malloc(len); + char* str = cast(char*)GC.malloc(len); str[0] = '['; p = str + 1; @@ -63,8 +64,7 @@ //printf("Array::reserve: size = %d, offset = %d, nbytes = %d\n", size, offset, nbytes); if (allocdim - dim < nentries) { allocdim = dim + nentries; - /// data = (void **)mem.realloc(data, allocdim * sizeof(*data)); - data = cast(void**)realloc(data, allocdim * (*data).sizeof); + data = cast(void**)GC.realloc(data, allocdim * (*data).sizeof); } } @@ -81,8 +81,7 @@ { if (dim != allocdim) { - ///data = (void**)mem.realloc(data, dim * sizeof(*data)); - data = cast(void**)realloc(data, dim * (*data).sizeof); + data = cast(void**)GC.realloc(data, dim * (*data).sizeof); allocdim = dim; } }