Selaa lähdekoodia

Use `reserve` in `LocalVector::resize`, to restore expected growth behavior.

Lukas Tenbrink 1 kuukausi sitten
vanhempi
commit
697e0bb077
1 muutettua tiedostoa jossa 1 lisäystä ja 5 poistoa
  1. 1 5
      core/templates/local_vector.h

+ 1 - 5
core/templates/local_vector.h

@@ -59,11 +59,7 @@ private:
 			}
 			count = p_size;
 		} else if (p_size > count) {
-			if (unlikely(p_size > capacity)) {
-				capacity = tight ? p_size : nearest_power_of_2_templated(p_size);
-				data = (T *)memrealloc(data, capacity * sizeof(T));
-				CRASH_COND_MSG(!data, "Out of memory");
-			}
+			reserve(p_size);
 			if constexpr (p_init) {
 				memnew_arr_placement(data + count, p_size - count);
 			} else {