From a553c9b0601d125aaf7893b216db5c72307161c6 Mon Sep 17 00:00:00 2001 From: Grace Yoder Date: Thu, 25 Jun 2026 11:47:54 -0600 Subject: [PATCH] refactor: create new run function in main using anytype --- src/main.zig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.zig b/src/main.zig index 2d5bc56..ea234e5 100644 --- a/src/main.zig +++ b/src/main.zig @@ -11,11 +11,16 @@ pub fn main(init: std.process.Init) !void { std.process.exit(1); } - std.debug.print("\x1b[0;32mCopying the following to Pasteboard\x1b[0m\n", .{}); - // We want to avoid doing as many allocations as possible so having raw // pages with it being larger should be totally fine var clip = try Clip.OSC52.init(std.heap.page_allocator, init.io, std.heap.pageSize()); + defer clip.free(); + + run(io, clip); +} + +pub fn run(io: *std.Io, clip: anytype) !void { + std.debug.print("\x1b[0;32mCopying the following to Pasteboard\x1b[0m\n", .{}); var buf: [4096]u8 = undefined; while (true) {