aboutsummaryrefslogtreecommitdiff
path: root/std/debug.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-11-10 15:01:09 -0500
committerAndrew Kelley <superjoe30@gmail.com>2017-11-10 15:01:09 -0500
commit6bf1547148caf0c63605a42c8cdea608cf3d4eca (patch)
tree518cb47a9dab91cfb7e7d9491cfe97ed59895d87 /std/debug.zig
parent336d81894da2c34a77cffd1bf903ad9e4dcaa7aa (diff)
parent029d37d6a7dc96f71dded5d5a9c8e7477aaa4146 (diff)
downloadzig-6bf1547148caf0c63605a42c8cdea608cf3d4eca.tar.gz
zig-6bf1547148caf0c63605a42c8cdea608cf3d4eca.zip
Merge branch 'darwin-stat'
closes #606
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,