D-Programming-Language/phobos — pull request #2023 by tom-tan (2014-03-19 04:42:55+00:00)
Title: Make std.utf.toUTFz safe and pure

This PR makes `std.utf.toUTFz` and `toUTFzImpl` safe and pure

`toUTFzImpl` uses pointer arithmetics and cast to immutable types but we can verify that they can be trusted.
By making `toUTFzImpl` safe, `toUTFz` can be infered as safe.
They can also be marked as pure because they do not include any impure operations.

I also make some of the unittest for them safe and pure.
One of the unittest uses a system function `std.exception.assumeUnique` and uses pointer slicings but we can verify that they can be trusted part in the unittest.
I marked one another unittest as pure but do not mark it as safe because it uses a system function `core.stdc.stdio.printf` in debug block.