nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1b89e1e
)
core: Bytes have a minimum capacity of 16 bytes
author
Alexis Laferrière
<alexis.laf@xymus.net>
Fri, 8 Sep 2017 14:43:32 +0000
(10:43 -0400)
committer
Alexis Laferrière
<alexis.laf@xymus.net>
Fri, 15 Sep 2017 12:25:57 +0000
(08:25 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/core/bytes.nit
patch
|
blob
|
history
diff --git
a/lib/core/bytes.nit
b/lib/core/bytes.nit
index
d53a76c
..
e375e60
100644
(file)
--- 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)