code: create util.allocator and use globally
river is not a library and passing a general purpose allocators around everywhere does not make sense and leads to ugly code. This does not prevent us from using local arenas if they are fitting.
This commit is contained in:
@ -51,7 +51,7 @@ pub fn init(self: *Self, server: *Server) !void {
|
||||
|
||||
self.seats = std.TailQueue(Seat).init();
|
||||
|
||||
const seat_node = try server.allocator.create(std.TailQueue(Seat).Node);
|
||||
const seat_node = try util.allocator.create(std.TailQueue(Seat).Node);
|
||||
try seat_node.data.init(self, default_seat_name);
|
||||
self.default_seat = &seat_node.data;
|
||||
self.seats.prepend(seat_node);
|
||||
@ -78,7 +78,7 @@ pub fn init(self: *Self, server: *Server) !void {
|
||||
pub fn deinit(self: *Self) void {
|
||||
while (self.seats.pop()) |seat_node| {
|
||||
seat_node.data.deinit();
|
||||
self.server.allocator.destroy(seat_node);
|
||||
util.allocator.destroy(seat_node);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user