diff options
author | Chris Lattner <sabre@nondot.org> | 2007-04-04 00:44:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-04-04 00:44:31 +0000 |
commit | d2f197da59a3c937c1809997907918c029f9f884 (patch) | |
tree | 479b3c7fb090adf6dbee7b4e2b64d234ddfdbfb3 /lib/Support/StringMap.cpp | |
parent | cb917f7abd1d929ea1e2558c6fd5860ed23339c2 (diff) |
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
Diffstat (limited to 'lib/Support/StringMap.cpp')
-rw-r--r-- | lib/Support/StringMap.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/Support/StringMap.cpp b/lib/Support/StringMap.cpp index caf9ba350e..e7263e247b 100644 --- a/lib/Support/StringMap.cpp +++ b/lib/Support/StringMap.cpp @@ -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 |