From 75ccf913acee097ce29fcfd3d916442fdb73b32e Mon Sep 17 00:00:00 2001 From: Jacob Jonsson Date: Sun, 4 Jan 2026 23:54:26 +0100 Subject: [PATCH] refactor(bot.zig): deinit all backlog slots Previously we deinited backwards from the most recently heard message until we reach a null-slot. Now this code has been simplified to walk the backlog and deinit any found messages. --- src/bot.zig | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/bot.zig b/src/bot.zig index 658e6b6..db2474d 100644 --- a/src/bot.zig +++ b/src/bot.zig @@ -171,12 +171,9 @@ pub const Bot = struct { } self.sent_messages.deinit(self.allocator); - var idx = self.previous_idx(self.top); - while (idx != self.bottom) : (idx = self.previous_idx(idx)) { - if (self.backlog[idx]) |message| { + for (self.backlog) |slot| { + if (slot) |message| { message.deinit(self.allocator); - } else { - break; } } }