Skip to content
  • Arne Goedeke's avatar
    Stdio.Buffer: fixed growth strategy · 62d0b4a4
    Arne Goedeke authored
    Unless trim() was called manually or unless the buffer was empty,
    the growth strategy would never reuse empty space at the beginning
    of the buffer. Instead, it would always allocate more space.
    
    The code now works as described in the comment. When at least half of
    the buffer space in the beginning of the allocated region is unused,
    the data is moved to the front before new memory is being allocated.
    62d0b4a4