mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
use calloc instead of new/memset, it is more efficient
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35644 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cb917f7abd
commit
d2f197da59
@ -279,7 +279,7 @@ public:
|
||||
if (I->Item && I->Item != getTombstoneVal())
|
||||
static_cast<MapEntryTy*>(I->Item)->Destroy(Allocator);
|
||||
}
|
||||
delete [] TheTable;
|
||||
free(TheTable);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -38,8 +38,7 @@ void StringMapImpl::init(unsigned InitSize) {
|
||||
NumItems = 0;
|
||||
NumTombstones = 0;
|
||||
|
||||
TheTable = new ItemBucket[NumBuckets+1]();
|
||||
memset(TheTable, 0, NumBuckets*sizeof(ItemBucket));
|
||||
TheTable = (ItemBucket*)calloc(NumBuckets+1, sizeof(ItemBucket));
|
||||
|
||||
// Allocate one extra bucket, set it to look filled so the iterators stop at
|
||||
// end.
|
||||
@ -200,8 +199,7 @@ void StringMapImpl::RehashTable() {
|
||||
unsigned NewSize = NumBuckets*2;
|
||||
// Allocate one extra bucket which will always be non-empty. This allows the
|
||||
// iterators to stop at end.
|
||||
ItemBucket *NewTableArray = new ItemBucket[NewSize+1]();
|
||||
memset(NewTableArray, 0, NewSize*sizeof(ItemBucket));
|
||||
ItemBucket *NewTableArray =(ItemBucket*)calloc(NewSize+1, sizeof(ItemBucket));
|
||||
NewTableArray[NewSize].Item = (StringMapEntryBase*)2;
|
||||
|
||||
// Rehash all the items into their new buckets. Luckily :) we already have
|
||||
|
Loading…
x
Reference in New Issue
Block a user