mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-08 04:05:35 -05:00
fix: proper amortized O(1) push in Buf.push
This commit is contained in:
parent
45bc589e00
commit
51519fec1f
1 changed files with 1 additions and 1 deletions
|
|
@ -41,7 +41,7 @@ module Buf_ = struct
|
||||||
|
|
||||||
let add_bytes (self:t) s i len : unit =
|
let add_bytes (self:t) s i len : unit =
|
||||||
if self.i + len >= Bytes.length self.bytes then (
|
if self.i + len >= Bytes.length self.bytes then (
|
||||||
resize self (self.i + len + 10);
|
resize self (self.i + self.i / 2 + len + 10);
|
||||||
);
|
);
|
||||||
Bytes.blit s i self.bytes self.i len;
|
Bytes.blit s i self.bytes self.i len;
|
||||||
self.i <- self.i + len
|
self.i <- self.i + len
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue