Fix an overly pessimistic size calculation in Builder::reserve().
This compared the Buffer's current size with the desired target size, but it should rather have compared with the Buffer's capacity.
The change rectifies that, so we can avoid unnecessary calls into Buffer::reserve() now, which would have returned from the call anyway in case enough Buffer capacity was still available to satisfy the reserve request.
Coverage increased (+0.02%) to 96.458% when pulling 2a74ccf0409791f7d995fca303acd94fd9e4d79d on bug-fix/fix-overly-pessimistic-size-calculation into 437dc4a58ab01e401b5cbd3004e6e0c54885f5b1 on main.
Fix an overly pessimistic size calculation in
Builder::reserve()
. This compared the Buffer's current size with the desired target size, but it should rather have compared with the Buffer's capacity. The change rectifies that, so we can avoid unnecessary calls intoBuffer::reserve()
now, which would have returned from the call anyway in case enough Buffer capacity was still available to satisfy the reserve request.