From ae61892d7db1c44c4f08fa1c2f3da6262e3f8fa2 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Sat, 7 Mar 2020 13:06:10 -0800 Subject: [PATCH] rename HashSet::resize to reserve --- search/Search.cc | 4 ++-- util/HashSet.hh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/search/Search.cc b/search/Search.cc index 00f78336..9bf9f165 100644 --- a/search/Search.cc +++ b/search/Search.cc @@ -2662,7 +2662,7 @@ Search::findTagGroup(TagGroupBldr *tag_bldr) tag_groups_ = new_tag_groups; tag_group_capacity_ = new_capacity; delete [] old_tag_groups; - tag_group_set_->resize(new_capacity); + tag_group_set_->reserve(new_capacity); } if (tag_group_next_ > tag_group_index_max) internalError("max tag group index exceeded"); @@ -2889,7 +2889,7 @@ Search::findTag(const RiseFall *rf, tags_ = new_tags; delete [] old_tags; tag_capacity_ = new_capacity; - tag_set_->resize(new_capacity); + tag_set_->reserve(new_capacity); } if (tag_next_ > tag_index_max) internalError("max tag index exceeded"); diff --git a/util/HashSet.hh b/util/HashSet.hh index 00d7cc60..58e3b933 100644 --- a/util/HashSet.hh +++ b/util/HashSet.hh @@ -40,7 +40,7 @@ public: // Number of hash buckets. size_t capacity() const { return capacity_; } // Multi-threaded findKey is safe during resize. - void resize(size_t capacity); + void reserve(size_t capacity); void insert(KEY key); KEY findKey(KEY key); KEY findKey(KEY key) const; @@ -308,12 +308,12 @@ HashSet::insert(KEY key) size_++; if (size_ > capacity_ && auto_resize_) - resize(nextMersenne(capacity_)); + reserve(nextMersenne(capacity_)); } template void -HashSet::resize(size_t capacity) +HashSet::reserve(size_t capacity) { if (capacity != capacity_) { if (size_ == 0) {