D-Programming-Language/dmd — pull request #3154 by yebblies (2014-01-26 06:11:07+00:00)
Title: [cleanup] Clean up the way strings are created from `OutBuffer`

- Introduce `extractString` which appends a `'\0'` if necessary then takes ownership of the data
- Replace `toChars` with `peekString` which appends a `'\0'` if necessary then returns a reference to the internal buffer
- Remove `writebyte` which is just a less-popular alias of `writeByte`

`toChars` is especially nasty in that it does not return a unique heap-backed string unlike `Object::toChars`.

See also: https://d.puremagic.com/issues/show_bug.cgi?id=9421

@AndrejMitrovic