~novakane/zelbar

e404000e6430346adac85ea0692c65cacd3456fe — Hugo Machet 8 months ago 2ed3a75
Backend: Remove Seat name

No need to allocate memory for something we don't use.
1 files changed, 1 insertions(+), 10 deletions(-)

M src/Backend.zig
M src/Backend.zig => src/Backend.zig +1 -10
@@ 104,7 104,6 @@ const Seat = struct {
    const CursorShape = enum { none, arrow, hand };

    wl_seat: *wl.Seat,
    name: ?[]const u8 = null,
    id: u32,

    // Pointer related objects.


@@ 129,7 128,6 @@ const Seat = struct {
    fn deinit(seat: *Seat) void {
        seat.release_pointer();
        seat.wl_seat.release();
        if (seat.name) |name| ctx.gpa.free(name);
    }

    fn seat_listener(_: *wl.Seat, event: wl.Seat.Event, seat: *Seat) void {


@@ 141,14 139,7 @@ const Seat = struct {
                    seat.release_pointer();
                }
            },
            .name => |ev| {
                seat.name = ctx.gpa.dupe(u8, mem.span(ev.name)) catch |err| switch (err) {
                    error.OutOfMemory => {
                        log.err("out of memory", .{});
                        return;
                    },
                };
            },
            .name => {},
        }
    }