diff --git a/src/bin_export.zig b/src/bin_export.zig index e197344..72140c7 100644 --- a/src/bin_export.zig +++ b/src/bin_export.zig @@ -118,7 +118,7 @@ pub const Thread = struct { } fn flush(t: *Thread, expected_len: usize) void { - @setCold(true); + @branchHint(.cold); const block = createBlock(t); defer block.deinit(); diff --git a/src/bin_reader.zig b/src/bin_reader.zig index 7d1b55d..b916661 100644 --- a/src/bin_reader.zig +++ b/src/bin_reader.zig @@ -63,7 +63,7 @@ inline fn bigu32(v: [4]u8) u32 { return std.mem.bigToNative(u32, @bitCast(v)); } inline fn bigu64(v: [8]u8) u64 { return std.mem.bigToNative(u64, @bitCast(v)); } fn die() noreturn { - @setCold(true); + @branchHint(.cold); if (global.lastitem) |e| ui.die("Error reading item {x} from file\n", .{e}) else ui.die("Error reading from file\n", .{}); } diff --git a/src/json_export.zig b/src/json_export.zig index 2885d0a..222a26f 100644 --- a/src/json_export.zig +++ b/src/json_export.zig @@ -73,7 +73,7 @@ pub const Writer = struct { dir_entry_open: bool = false, fn flush(ctx: *Writer, bytes: usize) void { - @setCold(true); + @branchHint(.cold); // This can only really happen when the root path exceeds PATH_MAX, // in which case we would probably have error'ed out earlier anyway. if (bytes > ctx.buf.len) ui.die("Error writing JSON export: path too long.\n", .{}); diff --git a/src/json_import.zig b/src/json_import.zig index 0683aef..0b69f22 100644 --- a/src/json_import.zig +++ b/src/json_import.zig @@ -83,7 +83,7 @@ const Parser = struct { } fn fill(p: *Parser) void { - @setCold(true); + @branchHint(.cold); p.rdoff = 0; p.rdsize = (if (p.zstd) |z| z.read(p.rd, &p.buf) else p.rd.read(&p.buf)) catch |e| switch (e) { error.IsDir => p.die("not a file"), // should be detected at open() time, but no flag for that... @@ -133,7 +133,7 @@ const Parser = struct { } fn stringContentSlow(p: *Parser, buf: []u8, head: u8, off: usize) []u8 { - @setCold(true); + @branchHint(.cold); var b = head; var n = off; while (true) { diff --git a/src/main.zig b/src/main.zig index ddbf37d..817188c 100644 --- a/src/main.zig +++ b/src/main.zig @@ -63,7 +63,7 @@ pub const allocator = std.mem.Allocator{ // Custom panic impl to reset the terminal before spewing out an error message. pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, ret_addr: ?usize) noreturn { - @setCold(true); + @branchHint(.cold); ui.deinit(); std.debug.panicImpl(error_return_trace, ret_addr orelse @returnAddress(), msg); } diff --git a/src/ui.zig b/src/ui.zig index 2eacd26..cb48df7 100644 --- a/src/ui.zig +++ b/src/ui.zig @@ -37,7 +37,7 @@ pub fn quit() noreturn { // no clue if ncurses will consistently report OOM, but we're not handling that // right now. pub fn oom() void { - @setCold(true); + @branchHint(.cold); if (main_thread == std.Thread.getCurrentId()) { const haveui = inited; deinit();