mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-12 17:08:39 -09:00
change deprecated @setCold(true) to @branchHint(.cold)
New `@branchHint` builtin is more expressive than `@setCold`, therefore latter was removed. See https://github.com/ziglang/zig/pull/21214 . Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
This commit is contained in:
parent
607b07a30e
commit
e0ab5d40c7
6 changed files with 7 additions and 7 deletions
|
|
@ -118,7 +118,7 @@ pub const Thread = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn flush(t: *Thread, expected_len: usize) void {
|
fn flush(t: *Thread, expected_len: usize) void {
|
||||||
@setCold(true);
|
@branchHint(.cold);
|
||||||
const block = createBlock(t);
|
const block = createBlock(t);
|
||||||
defer block.deinit();
|
defer block.deinit();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)); }
|
inline fn bigu64(v: [8]u8) u64 { return std.mem.bigToNative(u64, @bitCast(v)); }
|
||||||
|
|
||||||
fn die() noreturn {
|
fn die() noreturn {
|
||||||
@setCold(true);
|
@branchHint(.cold);
|
||||||
if (global.lastitem) |e| ui.die("Error reading item {x} from file\n", .{e})
|
if (global.lastitem) |e| ui.die("Error reading item {x} from file\n", .{e})
|
||||||
else ui.die("Error reading from file\n", .{});
|
else ui.die("Error reading from file\n", .{});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ pub const Writer = struct {
|
||||||
dir_entry_open: bool = false,
|
dir_entry_open: bool = false,
|
||||||
|
|
||||||
fn flush(ctx: *Writer, bytes: usize) void {
|
fn flush(ctx: *Writer, bytes: usize) void {
|
||||||
@setCold(true);
|
@branchHint(.cold);
|
||||||
// This can only really happen when the root path exceeds PATH_MAX,
|
// This can only really happen when the root path exceeds PATH_MAX,
|
||||||
// in which case we would probably have error'ed out earlier anyway.
|
// 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", .{});
|
if (bytes > ctx.buf.len) ui.die("Error writing JSON export: path too long.\n", .{});
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ const Parser = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fill(p: *Parser) void {
|
fn fill(p: *Parser) void {
|
||||||
@setCold(true);
|
@branchHint(.cold);
|
||||||
p.rdoff = 0;
|
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) {
|
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...
|
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 {
|
fn stringContentSlow(p: *Parser, buf: []u8, head: u8, off: usize) []u8 {
|
||||||
@setCold(true);
|
@branchHint(.cold);
|
||||||
var b = head;
|
var b = head;
|
||||||
var n = off;
|
var n = off;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ pub const allocator = std.mem.Allocator{
|
||||||
|
|
||||||
// Custom panic impl to reset the terminal before spewing out an error message.
|
// 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 {
|
pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, ret_addr: ?usize) noreturn {
|
||||||
@setCold(true);
|
@branchHint(.cold);
|
||||||
ui.deinit();
|
ui.deinit();
|
||||||
std.debug.panicImpl(error_return_trace, ret_addr orelse @returnAddress(), msg);
|
std.debug.panicImpl(error_return_trace, ret_addr orelse @returnAddress(), msg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ pub fn quit() noreturn {
|
||||||
// no clue if ncurses will consistently report OOM, but we're not handling that
|
// no clue if ncurses will consistently report OOM, but we're not handling that
|
||||||
// right now.
|
// right now.
|
||||||
pub fn oom() void {
|
pub fn oom() void {
|
||||||
@setCold(true);
|
@branchHint(.cold);
|
||||||
if (main_thread == std.Thread.getCurrentId()) {
|
if (main_thread == std.Thread.getCurrentId()) {
|
||||||
const haveui = inited;
|
const haveui = inited;
|
||||||
deinit();
|
deinit();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue