Bug 1185763 - Part 4: Swap elements if possible in r-value version of nsTArray::AppendElements. r=froydnj

This commit is contained in:
Birunthan Mohanathas 2015-08-11 08:29:46 -07:00
parent 2b4a52cf2e
commit 0527ccb54c

View File

@ -1544,6 +1544,11 @@ public:
elem_type* AppendElements(nsTArray_Impl<Item, Allocator>&& aArray)
{
MOZ_ASSERT(&aArray != this, "argument must be different aArray");
if (Length() == 0) {
SwapElements(aArray);
return Elements();
}
index_type len = Length();
index_type otherLen = aArray.Length();
if (!Alloc::Successful(this->template EnsureCapacity<Alloc>(