This growth scheme pretty much *triples* buffer length, doesn't it? You start with at least `buf.length` (`+=`), you make it add `neededLength` to it, and finally, you add `buf.length` *again*. I think either of `+=` or `buf.length` was meant, but not both? In any case, since this is a path building function, it seems a bit excessive...

It doesn't matter much, given probably *very* little user code will actually end up going here, but we wouldn't want to set a copy-paste trend...

Maybe a more conservative:
```D
buf.length = neededLength  + buf.length / 2;
```
? That's about a 50%+ increase when you go in there.

BTW, when growing a buffer, but you don't care about exact size, you can also take ownership of any GC "overallocation". If you do this, then instead of requesting a "buf.length", you can start with a "buf.reserve", and then grow to whatever your capacity is. The overall result gives us something like:

```D
immutable neededLength = pos + segment.length + 1;
if (buf.length < neededLength)
{
    auto u = buf.reserve(neededLength  + buf.length / 2); //Request more room
    buf.length = u; //Use up *all* of the used room.
}
```
Given GC usually grows by a factor 2 when smaller than a page, this will pretty much mean you will get a "perfect" x2 growth every time, up to about 16K.

But again, this is *not* very important taking into account what this function does.