zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit b3ecdfd7bfb9c6b3bd085b489fe20dd0ca1e12d8 (tree)
parent 5f4fcd5030fa93cf2518f98ffc666e4e4dc1052b
Author: Marc Tiehuis <marctiehuis@gmail.com>
Date:   Tue, 26 Mar 2019 20:31:16 +1300

Fix big.Int toString maybe-null allocator

Diffstat:
Mstd/math/big/int.zig | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/std/math/big/int.zig b/std/math/big/int.zig @@ -449,9 +449,11 @@ pub const Int = struct { comptime FmtError: type, output: fn (@typeOf(context), []const u8) FmtError!void, ) FmtError!void { + self.assertWritable(); // TODO look at fmt and support other bases - const str = self.toString(self.allocator, 10) catch @panic("TODO make this non allocating"); - defer self.allocator.free(str); + // TODO support read-only fixed integers + const str = self.toString(self.allocator.?, 10) catch @panic("TODO make this non allocating"); + defer self.allocator.?.free(str); return output(context, str); }