Fix bug 62791 - realloc now does in-place realloc when it can. r=pinkerton, sr=beard

This commit is contained in:
sfraser%netscape.com 2000-12-14 22:07:36 +00:00
Родитель f09d25e85c
Коммит 24c2721346
1 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -615,6 +615,12 @@ void *malloc(size_t blockSize)
static UInt32 sBlockID = 0;
blockHeader->blockID = sBlockID++;
}
#if 0
else
{
DebugStr("\pAllocation failure");
}
#endif
return newBlock;
#else
@ -677,15 +683,15 @@ void* realloc(void* block, size_t newSize)
switch (allocator->GetAllocatorType())
{
case nsMemAllocator::eAllocatorTypeFixed:
((nsFixedSizeAllocator*)allocator)->AllocatorResizeBlock(block, newSize);
newBlock = ((nsFixedSizeAllocator*)allocator)->AllocatorResizeBlock(block, newSize);
break;
case nsMemAllocator::eAllocatorTypeSmall:
((nsSmallHeapAllocator*)allocator)->AllocatorResizeBlock(block, newSize);
newBlock = ((nsSmallHeapAllocator*)allocator)->AllocatorResizeBlock(block, newSize);
break;
case nsMemAllocator::eAllocatorTypeLarge:
((nsLargeHeapAllocator*)allocator)->AllocatorResizeBlock(block, newSize);
newBlock = ((nsLargeHeapAllocator*)allocator)->AllocatorResizeBlock(block, newSize);
break;
}