From 697a18b851905daf863c5a72a3371fa315c940a8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Fri, 8 Sep 2017 10:43:32 -0400 Subject: [PATCH] core: Bytes have a minimum capacity of 16 bytes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/core/bytes.nit | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/core/bytes.nit b/lib/core/bytes.nit index d53a76c..e375e60 100644 --- a/lib/core/bytes.nit +++ b/lib/core/bytes.nit @@ -461,6 +461,7 @@ class Bytes redef fun enlarge(sz) do if capacity >= sz then return persisted = false + if capacity < 16 then capacity = 16 while capacity < sz do capacity = capacity * 2 + 2 var ns = new CString(capacity) items.copy_to(ns, length, 0, 0) -- 1.7.9.5