Skip to content

Commit f7db2b9

Browse files
committed
Linter errors
1 parent 9488be8 commit f7db2b9

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

core/src/utilities.zig

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -510,12 +510,14 @@ pub const StackIterator = struct {
510510
fp: usize,
511511

512512
pub fn next(it: *StackIterator) ?usize {
513+
if (!can_use_fp_based_stack_trace) return null;
514+
513515
const fp = it.fp;
514516

515-
if (!can_use_fp_based_stack_trace and fp == 0) return null; // we reached the "sentinel" base pointer
517+
if (fp == 0) return null; // we reached the "sentinel" base pointer
516518

517-
const bp_addr = applyOffset(fp, fp_to_bp_offset) orelse return null;
518-
const ra_addr = applyOffset(fp, fp_to_ra_offset) orelse return null;
519+
const bp_addr = apply_offset(fp, fp_to_bp_offset) orelse return null;
520+
const ra_addr = apply_offset(fp, fp_to_ra_offset) orelse return null;
519521

520522
if (bp_addr == 0 or !std.mem.isAligned(bp_addr, @alignOf(usize)) or
521523
ra_addr == 0 or !std.mem.isAligned(ra_addr, @alignOf(usize)))
@@ -526,7 +528,7 @@ pub const StackIterator = struct {
526528

527529
const bp_ptr: *const usize = @ptrFromInt(bp_addr);
528530
const ra_ptr: *const usize = @ptrFromInt(ra_addr);
529-
const bp = applyOffset(bp_ptr.*, stack_bias) orelse return null;
531+
const bp = apply_offset(bp_ptr.*, stack_bias) orelse return null;
530532

531533
// If the stack grows downwards, `bp > fp` should always hold; conversely, if it
532534
// grows upwards, `bp < fp` should always hold. If that is not the case, this
@@ -649,7 +651,7 @@ pub const StackIterator = struct {
649651
break :off 1;
650652
};
651653

652-
fn applyOffset(addr: usize, comptime off: comptime_int) ?usize {
654+
fn apply_offset(addr: usize, comptime off: comptime_int) ?usize {
653655
if (off >= 0) return std.math.add(usize, addr, off) catch return null;
654656
return std.math.sub(usize, addr, -off) catch return null;
655657
}

0 commit comments

Comments
 (0)