From 56cd1be82fd1679463d804d8bd4849ea4585d841 Mon Sep 17 00:00:00 2001 From: gitee-bot Date: Thu, 26 Mar 2026 10:39:37 +0000 Subject: [PATCH] docs: add documentation comments for functions in PR #59604 --- src/backend/Assembly.zig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/backend/Assembly.zig b/src/backend/Assembly.zig index 5a2afae..7eaf523 100644 --- a/src/backend/Assembly.zig +++ b/src/backend/Assembly.zig @@ -7,11 +7,16 @@ text: []const u8, const Assembly = @This(); +/// Deallocates the memory used by the Assembly instance. +/// Frees both the data and text sections. pub fn deinit(self: *const Assembly, gpa: Allocator) void { gpa.free(self.data); gpa.free(self.text); } +/// Writes the Assembly data and text sections to a file. +/// Uses writev to efficiently write both sections in a single system call. +/// Returns an error if the write operation fails. pub fn writeToFile(self: Assembly, file: std.fs.File) !void { var vec: [2]std.posix.iovec_const = .{ .{ .base = self.data.ptr, .len = self.data.len }, -- Gitee