aboutsummaryrefslogtreecommitdiff
path: root/std/math/big/int.zig
diff options
context:
space:
mode:
authorMarc Tiehuis <marctiehuis@gmail.com>2019-03-26 20:31:16 +1300
committerMarc Tiehuis <marctiehuis@gmail.com>2019-04-11 19:36:35 +1200
commitb3ecdfd7bfb9c6b3bd085b489fe20dd0ca1e12d8 (patch)
tree95d48d81113c55e7dd4d828806218010dee037e4 /std/math/big/int.zig
parent5f4fcd5030fa93cf2518f98ffc666e4e4dc1052b (diff)
downloadzig-b3ecdfd7bfb9c6b3bd085b489fe20dd0ca1e12d8.tar.gz
zig-b3ecdfd7bfb9c6b3bd085b489fe20dd0ca1e12d8.zip
Fix big.Int toString maybe-null allocator
Diffstat (limited to 'std/math/big/int.zig')
-rw-r--r--std/math/big/int.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/std/math/big/int.zig b/std/math/big/int.zig
index 7812d1ee06..89be663a4a 100644
--- 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);
}