diff options
| author | gingerBill <bill@gingerbill.org> | 2023-05-03 17:06:37 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-05-03 17:06:37 +0100 |
| commit | e82146bf17908dcc3619c8ec34bb0e902d7c213d (patch) | |
| tree | 4f1773056321fb981dcd39e78ecaa767a706e563 /src/ptr_map.cpp | |
| parent | 685f7d0feae7b7bbfee5b24f6e6dc6751366d36e (diff) | |
| parent | 0c3522133d60870e123b7d0e2aacb15c38e377f8 (diff) | |
Merge branch 'master' into separate-int-word-sizes
Diffstat (limited to 'src/ptr_map.cpp')
| -rw-r--r-- | src/ptr_map.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ptr_map.cpp b/src/ptr_map.cpp index e353b2f97..fbde98693 100644 --- a/src/ptr_map.cpp +++ b/src/ptr_map.cpp @@ -114,7 +114,9 @@ gb_internal MapIndex map__add_entry(PtrMap<K, V> *h, K key) { PtrMapEntry<K, V> e = {}; e.key = key; e.next = MAP_SENTINEL; - map__reserve_entries(h, h->count+1); + if (h->count+1 >= h->entries_capacity) { + map__reserve_entries(h, gb_max(h->entries_capacity*2, 4)); + } h->entries[h->count++] = e; return cast(MapIndex)(h->count-1); } |