From 9c871aac97bf6dffc1fa86ed514cfece562325f6 Mon Sep 17 00:00:00 2001 From: kayomn Date: Sun, 4 Jun 2023 12:34:48 +0000 Subject: [PATCH] Clarify panic wording in Ona heap implementation --- source/ona/heap.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/ona/heap.zig b/source/ona/heap.zig index 9c9a5eb..35fc21d 100644 --- a/source/ona/heap.zig +++ b/source/ona/heap.zig @@ -58,7 +58,7 @@ const Context = struct { const target_allocation_info = @intToPtr(*AllocationInfo, @ptrToInt(allocation.ptr) - @sizeOf(AllocationInfo)); if (target_allocation_info.size != allocation.len) { - @panic("incorrect allocation length"); + @panic("incorrect allocation length for deallocating"); } if (self.allocation_info_head) |allocation_info_head| { @@ -87,7 +87,7 @@ const Context = struct { } } - @panic("double-free detected"); + @panic("incorrect allocation address for deallocating"); } /// @@ -110,7 +110,7 @@ const Context = struct { const target_allocation_info = @intToPtr(*AllocationInfo, @ptrToInt(allocation.ptr) - allocation_info_size); if (target_allocation_info.size != allocation.len) { - @panic("incorrect allocation length"); + @panic("incorrect allocation length for reallocating"); } if (self.allocation_info_head) |allocation_info_head| { @@ -139,7 +139,7 @@ const Context = struct { } } - @panic("use-after-free detected"); + @panic("incorrect allocation address for reallocating"); } };