summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-04 00:44:31 +0000
committerChris Lattner <sabre@nondot.org>2007-04-04 00:44:31 +0000
commitadf83a35136dd8e0afd73a0a50258c30609680e9 (patch)
treec37d7181800f11954736db22b77b9f8c9d1955a6 /llvm/lib/Support
parentc712a1322ac74fc6f5f801cd57141368ea0a23c6 (diff)
downloadbcm5719-llvm-adf83a35136dd8e0afd73a0a50258c30609680e9.tar.gz
bcm5719-llvm-adf83a35136dd8e0afd73a0a50258c30609680e9.zip
use calloc instead of new/memset, it is more efficient
llvm-svn: 35644
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/StringMap.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Support/StringMap.cpp b/llvm/lib/Support/StringMap.cpp
index caf9ba350ef..e7263e247b3 100644
--- a/llvm/lib/Support/StringMap.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud