From 62bcb0c867e4f2dcf20cc86828fe13b92c667f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Gr=C3=A9goire?= Date: Fri, 17 Apr 2026 18:59:44 -0400 Subject: [PATCH] fix(mm): use const --- src/mm/vmem.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mm/vmem.zig b/src/mm/vmem.zig index a93d1c5..8e7d320 100644 --- a/src/mm/vmem.zig +++ b/src/mm/vmem.zig @@ -113,9 +113,9 @@ const Segment = struct { return @fieldParentPtr("linkage", linkage); } - fn cmp(a_node: *rtl.bst.Node, b_node: *rtl.bst.Node) std.math.Order { - const a: *Segment = Segment.from_tree_link(a_node); - const b: *Segment = Segment.from_tree_link(b_node); + fn cmp(a_node: *const rtl.bst.Node, b_node: *const rtl.bst.Node) std.math.Order { + const a = Segment.from_tree_link(@constCast(a_node)); + const b = Segment.from_tree_link(@constCast(b_node)); return std.math.order(a.base, b.base); } }; @@ -163,7 +163,7 @@ pub const Arena = struct { self.rotor = null; // Add initial span - try self.add(base, size); + try self.add(base, size); } pub fn deinit(self: *Self) void { @@ -418,7 +418,7 @@ pub const Arena = struct { // Try to fit the given segment to the request with the given options. // Returns the fitted address if successful. - fn try_to_fit(self: *Self, segment: *Segment, size: usize, options: AllocOptions) ?usize { + fn try_to_fit(self: *Self, segment: *const Segment, size: usize, options: AllocOptions) ?usize { var start = @max(segment.base, options.min orelse 0); const end = @min(segment.base + segment.size, options.max orelse std.math.maxInt(usize)); const alignment = options.alignment orelse self.quantum;