aboutsummaryrefslogtreecommitdiff
path: root/std/debug.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-11-10 16:45:01 -0500
committerAndrew Kelley <superjoe30@gmail.com>2017-11-10 16:45:01 -0500
commitdf89291d1ca04a5891dd48ea5f6d1a99b6006bcb (patch)
tree83970de0fdaa7383c11f64efceff7f88d6fd9cd9 /std/debug.zig
parente9d7623e1f0300b1b652373f2e0e7b605eaf13d1 (diff)
parent019f18058bb74816f8754de63a219347597e06da (diff)
downloadzig-df89291d1ca04a5891dd48ea5f6d1a99b6006bcb.tar.gz
zig-df89291d1ca04a5891dd48ea5f6d1a99b6006bcb.zip
Merge remote-tracking branch 'origin/master' into llvm6
Diffstat (limited to 'std/debug.zig')
-rw-r--r--std/debug.zig7
1 files changed, 4 insertions, 3 deletions
diff --git a/std/debug.zig b/std/debug.zig
index 23e951219a..50322024c3 100644
--- a/std/debug.zig
+++ b/std/debug.zig
@@ -38,7 +38,7 @@ fn getStderrStream() -> %&io.OutStream {
/// Tries to print a stack trace to stderr, unbuffered, and ignores any error returned.
pub fn dumpStackTrace() {
const stderr = getStderrStream() %% return;
- writeStackTrace(stderr, &global_allocator, stderr_file.isTty(), 1) %% return;
+ writeStackTrace(stderr, global_allocator, stderr_file.isTty(), 1) %% return;
}
/// This function invokes undefined behavior when `ok` is `false`.
@@ -86,7 +86,7 @@ pub fn panic(comptime format: []const u8, args: ...) -> noreturn {
const stderr = getStderrStream() %% os.abort();
stderr.print(format ++ "\n", args) %% os.abort();
- writeStackTrace(stderr, &global_allocator, stderr_file.isTty(), 1) %% os.abort();
+ writeStackTrace(stderr, global_allocator, stderr_file.isTty(), 1) %% os.abort();
os.abort();
}
@@ -967,7 +967,8 @@ fn readILeb128(in_stream: &io.InStream) -> %i64 {
}
}
-pub var global_allocator = mem.Allocator {
+pub const global_allocator = &global_allocator_state;
+var global_allocator_state = mem.Allocator {
.allocFn = globalAlloc,
.reallocFn = globalRealloc,
.freeFn = globalFree,