зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1271751 - part 7 - remove nsTArray_CopyWith*::Copy*; r=erahm
After all the previous patches, we never call these functions. Any copying required by nsTArray is taken care of by other means.
This commit is contained in:
Родитель
3d1192cadc
Коммит
229ede80e2
|
@ -575,24 +575,12 @@ struct nsTArray_CopyWithMemutils
|
|||
{
|
||||
const static bool allowRealloc = true;
|
||||
|
||||
static void CopyNonOverlappingRegion(void* aDest, const void* aSrc, size_t aCount,
|
||||
size_t aElemSize)
|
||||
{
|
||||
memcpy(aDest, aSrc, aCount * aElemSize);
|
||||
}
|
||||
|
||||
static void MoveNonOverlappingRegionWithHeader(void* aDest, const void* aSrc,
|
||||
size_t aCount, size_t aElemSize)
|
||||
{
|
||||
memcpy(aDest, aSrc, sizeof(nsTArrayHeader) + aCount * aElemSize);
|
||||
}
|
||||
|
||||
static void CopyOverlappingRegion(void* aDest, const void* aSrc, size_t aCount,
|
||||
size_t aElemSize)
|
||||
{
|
||||
memmove(aDest, aSrc, aCount * aElemSize);
|
||||
}
|
||||
|
||||
static void MoveOverlappingRegion(void* aDest, void* aSrc, size_t aCount,
|
||||
size_t aElemSize)
|
||||
{
|
||||
|
@ -617,24 +605,6 @@ struct nsTArray_CopyWithConstructors
|
|||
|
||||
const static bool allowRealloc = false;
|
||||
|
||||
static void CopyNonOverlappingRegion(void* aDest, void* aSrc, size_t aCount,
|
||||
size_t aElemSize)
|
||||
{
|
||||
ElemType* destElem = static_cast<ElemType*>(aDest);
|
||||
ElemType* srcElem = static_cast<ElemType*>(aSrc);
|
||||
ElemType* destElemEnd = destElem + aCount;
|
||||
#ifdef DEBUG
|
||||
ElemType* srcElemEnd = srcElem + aCount;
|
||||
MOZ_ASSERT(srcElemEnd <= destElem || srcElemEnd > destElemEnd);
|
||||
#endif
|
||||
while (destElem != destElemEnd) {
|
||||
traits::Construct(destElem, *srcElem);
|
||||
traits::Destruct(srcElem);
|
||||
++destElem;
|
||||
++srcElem;
|
||||
}
|
||||
}
|
||||
|
||||
static void MoveNonOverlappingRegionWithHeader(void* aDest, void* aSrc, size_t aCount,
|
||||
size_t aElemSize)
|
||||
{
|
||||
|
@ -646,27 +616,6 @@ struct nsTArray_CopyWithConstructors
|
|||
aCount, aElemSize);
|
||||
}
|
||||
|
||||
static void CopyOverlappingRegion(void* aDest, void* aSrc, size_t aCount,
|
||||
size_t aElemSize)
|
||||
{
|
||||
ElemType* destElem = static_cast<ElemType*>(aDest);
|
||||
ElemType* srcElem = static_cast<ElemType*>(aSrc);
|
||||
ElemType* destElemEnd = destElem + aCount;
|
||||
ElemType* srcElemEnd = srcElem + aCount;
|
||||
if (destElem == srcElem) {
|
||||
return; // In practice, we don't do this.
|
||||
} else if (srcElemEnd > destElem && srcElemEnd < destElemEnd) {
|
||||
while (destElemEnd != destElem) {
|
||||
--destElemEnd;
|
||||
--srcElemEnd;
|
||||
traits::Construct(destElemEnd, *srcElemEnd);
|
||||
traits::Destruct(srcElem);
|
||||
}
|
||||
} else {
|
||||
CopyNonOverlappingRegion(aDest, aSrc, aCount, aElemSize);
|
||||
}
|
||||
}
|
||||
|
||||
static void MoveOverlappingRegion(void* aDest, void* aSrc, size_t aCount,
|
||||
size_t aElemSize)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче