Skip to content

Commit

Permalink
Mark std.string.toStringz as @trusted
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-tan committed Mar 13, 2014
1 parent 6a95f08 commit 4f12ee2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions std/string.d
Expand Up @@ -148,7 +148,7 @@ unittest
to it in your D code. Otherwise, it may go away during a garbage collection
cycle and cause a nasty bug when the C code tries to use it.
+/
immutable(char)* toStringz(const(char)[] s) pure nothrow
immutable(char)* toStringz(const(char)[] s) @trusted pure nothrow
in
{
// The assert below contradicts the unittests!
Expand Down Expand Up @@ -191,7 +191,7 @@ body
}

/++ Ditto +/
immutable(char)* toStringz(string s) pure nothrow
immutable(char)* toStringz(string s) @trusted pure nothrow
{
if (s.empty) return "".ptr;
/* Peek past end of s[], if it's 0, no conversion necessary.
Expand All @@ -210,7 +210,7 @@ immutable(char)* toStringz(string s) pure nothrow
return toStringz(cast(const char[]) s);
}

unittest
pure nothrow unittest
{
debug(string) printf("string.toStringz.unittest\n");

Expand Down

0 comments on commit 4f12ee2

Please sign in to comment.