From 3e9093ff47f0d93fdebfb7cca581e3acf7c3de3e Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Mon, 19 Oct 2015 20:19:12 -0400 Subject: [PATCH] core::hash_collection: simplify `enlarge` Signed-off-by: Jean Privat --- lib/core/collection/hash_collection.nit | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lib/core/collection/hash_collection.nit b/lib/core/collection/hash_collection.nit index 7c9fc6a..890ecd9 100644 --- a/lib/core/collection/hash_collection.nit +++ b/lib/core/collection/hash_collection.nit @@ -165,7 +165,6 @@ private abstract class HashCollection[K] # Force a capacity fun enlarge(cap: Int) do - var old_cap = _capacity # get a new capacity if cap < _the_length + 1 then cap = _the_length + 1 if cap <= _capacity then return @@ -176,16 +175,6 @@ private abstract class HashCollection[K] var new_array = new NativeArray[nullable N](cap) _array = new_array - # clean the new array - var i = cap - 1 - while i >=0 do - new_array[i] = null - i -= 1 - end - - if _the_length == 0 then return - if _capacity <= old_cap then return - # Reput items in the array var node = _first_item while node != null do -- 1.7.9.5