diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /js/src/ds/OrderedHashTable.h | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | js/src/ds/OrderedHashTable.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/js/src/ds/OrderedHashTable.h b/js/src/ds/OrderedHashTable.h index 75c22bd123..9dd3e216d3 100644 --- a/js/src/ds/OrderedHashTable.h +++ b/js/src/ds/OrderedHashTable.h @@ -263,6 +263,12 @@ class OrderedHashTable { } *foundp = true; + return remove(e); + } + + bool remove(Data* e) { + MOZ_ASSERT(uint32_t(e - data) < dataCapacity); + liveCount--; Ops::makeEmpty(&e->element); @@ -277,6 +283,7 @@ class OrderedHashTable { return false; } } + return true; } @@ -967,6 +974,12 @@ class OrderedHashMap { bool remove(const Lookup& key, bool* foundp) { return impl.remove(key, foundp); } + // Remove an entry returned by get(). + bool remove(Entry* entry) { + static_assert(offsetof(typename Impl::Data, element) == 0); + auto* data = reinterpret_cast<typename Impl::Data*>(entry); + return impl.remove(data); + } [[nodiscard]] bool clear() { return impl.clear(); } template <typename K, typename V> |