Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions src/x.zig
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,6 @@ pub const max_display_num = max_port - TcpBasePort;
pub const BigEndian = 'B';
pub const LittleEndian = 'l';

// TODO: is there another way to do this, is this somewhere in std?
pub fn optEql(optLeft: anytype, optRight: anytype) bool {
if (optLeft) |left| {
if (optRight) |right| {
return left == right;
} else return false;
} else {
if (optRight) |_| {
return false;
} else return true;
}
}

pub const ParsedDisplay = struct {
proto: ?Protocol,
hostStart: u16,
Expand All @@ -83,7 +70,7 @@ pub const ParsedDisplay = struct {
return ptr[self.hostStart..self.hostLimit];
}
pub fn equals(self: @This(), other: @This()) bool {
return self.protoLen == other.protoLen and self.hostLimit == other.hostLimit and self.display_num == other.display_num and optEql(self.preferredScreen, other.preferredScreen);
return self.protoLen == other.protoLen and self.hostLimit == other.hostLimit and self.display_num == other.display_num and std.meta.eql(self.preferredScreen, other.preferredScreen);
}
};

Expand Down