Function deinit [src]

Call to free the internal buffer of the iterator.

Prototype

pub fn deinit(self: *ArgIteratorWasi) void

Parameters

self: *ArgIteratorWasi

Source

pub fn deinit(self: *ArgIteratorWasi) void { const last_item = self.args[self.args.len - 1]; const last_byte_addr = @intFromPtr(last_item.ptr) + last_item.len + 1; // null terminated const first_item_ptr = self.args[0].ptr; const len = last_byte_addr - @intFromPtr(first_item_ptr); self.allocator.free(first_item_ptr[0..len]); self.allocator.free(self.args); }