aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/c.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen/c.zig')
-rw-r--r--src/codegen/c.zig7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index 11c899bdd2..f54ae7f76d 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -163,14 +163,14 @@ pub const Object = struct {
/// This data is available both when outputting .c code and when outputting an .h file.
pub const DeclGen = struct {
- gpa: *std.mem.Allocator,
+ gpa: std.mem.Allocator,
module: *Module,
decl: *Decl,
fwd_decl: std.ArrayList(u8),
error_msg: ?*Module.ErrorMsg,
/// The key of this map is Type which has references to typedefs_arena.
typedefs: TypedefMap,
- typedefs_arena: *std.mem.Allocator,
+ typedefs_arena: std.mem.Allocator,
fn fail(dg: *DeclGen, comptime format: []const u8, args: anytype) error{ AnalysisFail, OutOfMemory } {
@setCold(true);
@@ -390,6 +390,7 @@ pub const DeclGen = struct {
// Fall back to generic implementation.
var arena = std.heap.ArenaAllocator.init(dg.module.gpa);
defer arena.deinit();
+ const arena_allocator = arena.allocator();
try writer.writeAll("{");
var index: usize = 0;
@@ -397,7 +398,7 @@ pub const DeclGen = struct {
const elem_ty = ty.elemType();
while (index < len) : (index += 1) {
if (index != 0) try writer.writeAll(",");
- const elem_val = try val.elemValue(&arena.allocator, index);
+ const elem_val = try val.elemValue(arena_allocator, index);
try dg.renderValue(writer, elem_ty, elem_val);
}
if (ty.sentinel()) |sentinel_val| {