aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-01-29 14:16:25 -0800
committerAndrew Kelley <andrew@ziglang.org>2025-02-06 14:23:23 -0800
commit284de7d957037c8a7032bd6e2a95bd5f55b73666 (patch)
tree852d4ef1e8fd8c052485fd38d0dcdfafd28594bb /lib/std/debug.zig
parent439667be0476f5bf60f3efbb82a3c4d5aae96ee4 (diff)
downloadzig-284de7d957037c8a7032bd6e2a95bd5f55b73666.tar.gz
zig-284de7d957037c8a7032bd6e2a95bd5f55b73666.zip
adjust runtime page size APIs
* fix merge conflicts * rename the declarations * reword documentation * extract FixedBufferAllocator to separate file * take advantage of locals * remove the assertion about max alignment in Allocator API, leaving it Allocator implementation defined * fix non-inline function call in start logic The GeneralPurposeAllocator implementation is totally broken because it uses global state but I didn't address that in this commit.
Diffstat (limited to 'lib/std/debug.zig')
-rw-r--r--lib/std/debug.zig15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index a3aacf769e..9deca6de49 100644
--- a/lib/std/debug.zig
+++ b/lib/std/debug.zig
@@ -2,7 +2,6 @@ const builtin = @import("builtin");
const std = @import("std.zig");
const math = std.math;
const mem = std.mem;
-const heap = std.heap;
const io = std.io;
const posix = std.posix;
const fs = std.fs;
@@ -1238,7 +1237,7 @@ test printLineFromFileAnyOs {
const overlap = 10;
var writer = file.writer();
- try writer.writeByteNTimes('a', heap.min_page_size - overlap);
+ try writer.writeByteNTimes('a', std.heap.page_size_min - overlap);
try writer.writeByte('\n');
try writer.writeByteNTimes('a', overlap);
@@ -1253,10 +1252,10 @@ test printLineFromFileAnyOs {
defer allocator.free(path);
var writer = file.writer();
- try writer.writeByteNTimes('a', heap.max_page_size);
+ try writer.writeByteNTimes('a', std.heap.page_size_max);
try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 1, .column = 0 });
- try expectEqualStrings(("a" ** heap.max_page_size) ++ "\n", output.items);
+ try expectEqualStrings(("a" ** std.heap.page_size_max) ++ "\n", output.items);
output.clearRetainingCapacity();
}
{
@@ -1266,18 +1265,18 @@ test printLineFromFileAnyOs {
defer allocator.free(path);
var writer = file.writer();
- try writer.writeByteNTimes('a', 3 * heap.max_page_size);
+ try writer.writeByteNTimes('a', 3 * std.heap.page_size_max);
try expectError(error.EndOfFile, printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 2, .column = 0 }));
try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 1, .column = 0 });
- try expectEqualStrings(("a" ** (3 * heap.max_page_size)) ++ "\n", output.items);
+ try expectEqualStrings(("a" ** (3 * std.heap.page_size_max)) ++ "\n", output.items);
output.clearRetainingCapacity();
try writer.writeAll("a\na");
try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 1, .column = 0 });
- try expectEqualStrings(("a" ** (3 * heap.max_page_size)) ++ "a\n", output.items);
+ try expectEqualStrings(("a" ** (3 * std.heap.page_size_max)) ++ "a\n", output.items);
output.clearRetainingCapacity();
try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 2, .column = 0 });
@@ -1291,7 +1290,7 @@ test printLineFromFileAnyOs {
defer allocator.free(path);
var writer = file.writer();
- const real_file_start = 3 * heap.min_page_size;
+ const real_file_start = 3 * std.heap.page_size_min;
try writer.writeByteNTimes('\n', real_file_start);
try writer.writeAll("abc\ndef");