Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1184 from MartinNowak/rmOldDup
Browse files Browse the repository at this point in the history
remove unused and deprecated _adDupT function
  • Loading branch information
yebblies committed Mar 5, 2015
2 parents 61ba4b8 + 79179fa commit 83bfb3c
Showing 1 changed file with 1 addition and 44 deletions.
45 changes: 1 addition & 44 deletions src/rt/lifetime.d
Expand Up @@ -1211,7 +1211,7 @@ extern (C) void _d_delarray_t(void[]* p, const TypeInfo_Struct ti)
unittest
{
__gshared size_t countDtor = 0;
struct S
struct S
{
int x;
~this() { countDtor++; }
Expand Down Expand Up @@ -2250,49 +2250,6 @@ void* _d_arrayliteralTX(const TypeInfo ti, size_t length)
}


/**
* Support for array.dup property.
*/
struct Array2
{
size_t length;
void* ptr;
}


/**
* Replaced by object.dup and object.idup.
* Remove in 2.068.
*/
deprecated extern (C) void[] _adDupT(const TypeInfo ti, void[] a)
out (result)
{
auto sizeelem = ti.next.tsize; // array element size
assert(memcmp((*cast(Array2*)&result).ptr, a.ptr, a.length * sizeelem) == 0);
}
body
{
Array2 r;

if (a.length)
{
auto tinext = unqualify(ti.next);
auto sizeelem = tinext.tsize; // array element size
auto size = a.length * sizeelem;
auto info = __arrayAlloc(size, ti, tinext);
auto isshared = typeid(ti) is typeid(TypeInfo_Shared);
__setArrayAllocLength(info, size, isshared, tinext);
r.ptr = __arrayStart(info);
r.length = a.length;
memcpy(r.ptr, a.ptr, size);

// do postblit processing
__doPostblit(r.ptr, size, tinext);
}
return *cast(void[]*)(&r);
}


unittest
{
int[] a;
Expand Down

0 comments on commit 83bfb3c

Please sign in to comment.