Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 110878b

Browse files
authored
Merge pull request #2365 from n8sh/zero-init-TempStringNoAlloc
Make TempStringNoAlloc zero-init + avoid unnecessary init merged-on-behalf-of: Jacob Carlborg <jacob-carlborg@users.noreply.github.com>
2 parents fd85e2d + 00b10b2 commit 110878b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/core/demangle.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ pure @safe:
277277
{
278278
import core.internal.string;
279279

280-
UnsignedStringBuf buf;
280+
UnsignedStringBuf buf = void;
281281

282282
auto s = unsignedToTempString(val, buf, 16);
283283
int slen = cast(int)s.length;

src/core/internal/abort.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void abort(scope string msg, scope string filename = __FILE__, size_t line = __L
3737
static assert(0, "Unsupported OS");
3838

3939
import core.internal.string;
40-
UnsignedStringBuf strbuff;
40+
UnsignedStringBuf strbuff = void;
4141

4242
// write an appropriate message, then abort the program
4343
writeStr("Aborting from ", filename, "(", line.unsignedToTempString(strbuff, 10), ") ", msg);

src/core/internal/string.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ char[] unsignedToTempString()(ulong value, return scope char[] buf, uint radix =
5656
private struct TempStringNoAlloc
5757
{
5858
// need to handle 65 bytes for radix of 2 with negative sign.
59-
private char[65] _buf;
59+
private char[65] _buf = void;
6060
private ubyte _len;
6161
auto get() return
6262
{

0 commit comments

Comments
 (0)