summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/StringMap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/StringMap.cpp')
-rw-r--r--llvm/lib/Support/StringMap.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/Support/StringMap.cpp b/llvm/lib/Support/StringMap.cpp
index 4341da2d97b..9382c3ce29e 100644
--- a/llvm/lib/Support/StringMap.cpp
+++ b/llvm/lib/Support/StringMap.cpp
@@ -57,10 +57,9 @@ void StringMapImpl::init(unsigned InitSize) {
NumItems = 0;
NumTombstones = 0;
- TheTable = (StringMapEntryBase **)calloc(NewNumBuckets+1,
- sizeof(StringMapEntryBase **) +
- sizeof(unsigned));
-
+ TheTable = static_cast<StringMapEntryBase **>(
+ std::calloc(NewNumBuckets+1,
+ sizeof(StringMapEntryBase **) + sizeof(unsigned)));
if (TheTable == nullptr)
report_bad_alloc_error("Allocation of StringMap table failed.");
@@ -219,10 +218,8 @@ unsigned StringMapImpl::RehashTable(unsigned BucketNo) {
unsigned NewBucketNo = BucketNo;
// Allocate one extra bucket which will always be non-empty. This allows the
// iterators to stop at end.
- StringMapEntryBase **NewTableArray =
- (StringMapEntryBase **)calloc(NewSize+1, sizeof(StringMapEntryBase *) +
- sizeof(unsigned));
-
+ auto NewTableArray = static_cast<StringMapEntryBase **>(
+ std::calloc(NewSize+1, sizeof(StringMapEntryBase *) + sizeof(unsigned)));
if (NewTableArray == nullptr)
report_bad_alloc_error("Allocation of StringMap hash table failed.");
OpenPOWER on IntegriCloud