From 358723922c81b9fa565351d5f35f239b968f2e3e Mon Sep 17 00:00:00 2001 From: Adriel Velazquez Date: Sun, 2 Feb 2025 17:18:39 -0800 Subject: [PATCH] Using the global allocator --- src/Surface.zig | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Surface.zig b/src/Surface.zig index 674f032cf..3ab2fa9ec 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -4325,10 +4325,8 @@ fn openScreenFile( std.log.debug("EDITOR environment variable not set", .{}); return error.EnvironmentVariableNotFound; }; - const allocator = std.heap.page_allocator; - const command_buf = try allocator.alloc(u8, editor.len + file_path.len + 2); - errdefer allocator.free(command_buf); - defer allocator.free(command_buf); + + const command_buf = try self.alloc.alloc(u8, editor.len + file_path.len + 2); // This is quite ugly sending the message to the mailbox and executing it on behalf of the user // Spawing a process doesn't render the command in the main surface. const command = try std.fmt.bufPrint( @@ -4338,7 +4336,7 @@ fn openScreenFile( ); self.io.queueMessage(try termio.Message.writeReq( - allocator, + self.alloc, command, ), .unlocked); }