mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-17 08:48:58 +00:00
setCAllocator
Replace custom malloc functions in netsurf libs with a global Zig allocator. Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
committed by
Pierre Tachoire
parent
f0773a3ca2
commit
76c88d049f
@@ -1,6 +1,7 @@
|
||||
const std = @import("std");
|
||||
|
||||
const jsruntime = @import("jsruntime");
|
||||
const setCAllocator = @import("calloc.zig").setCAllocator;
|
||||
|
||||
const parser = @import("netsurf.zig");
|
||||
const apiweb = @import("apiweb.zig");
|
||||
@@ -37,6 +38,10 @@ pub fn main() !void {
|
||||
var arena = std.heap.ArenaAllocator.init(gpa.allocator());
|
||||
defer arena.deinit();
|
||||
|
||||
var c_arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
|
||||
defer c_arena.deinit();
|
||||
setCAllocator(c_arena.allocator());
|
||||
|
||||
// document
|
||||
const file = try std.fs.cwd().openFile("test.html", .{});
|
||||
defer file.close();
|
||||
|
||||
Reference in New Issue
Block a user