From 5098553fb485dc85a5fdf991eae017cb311945df Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Fri, 21 Aug 2020 19:47:57 +0200 Subject: [PATCH] river-status: clean up initialization --- river/Control.zig | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/river/Control.zig b/river/Control.zig index 3fd1cb5..ee61794 100644 --- a/river/Control.zig +++ b/river/Control.zig @@ -38,18 +38,19 @@ wl_global: *c.wl_global, args_map: std.AutoHashMap(u32, std.ArrayList([]const u8)), -listen_display_destroy: c.wl_listener, +listen_display_destroy: c.wl_listener = undefined, pub fn init(self: *Self, server: *Server) !void { - self.wl_global = c.wl_global_create( - server.wl_display, - &c.zriver_control_v1_interface, - protocol_version, - self, - bind, - ) orelse return error.OutOfMemory; - - self.args_map = std.AutoHashMap(u32, std.ArrayList([]const u8)).init(util.gpa); + self.* = .{ + .wl_global = c.wl_global_create( + server.wl_display, + &c.zriver_control_v1_interface, + protocol_version, + self, + bind, + ) orelse return error.OutOfMemory, + .args_map = std.AutoHashMap(u32, std.ArrayList([]const u8)).init(util.gpa), + }; self.listen_display_destroy.notify = handleDisplayDestroy; c.wl_display_add_destroy_listener(server.wl_display, &self.listen_display_destroy);