mirror of
https://codeberg.org/fairyglade/ly.git
synced 2026-08-09 15:19:13 +02:00
Remove TODOs & fix bug in interop.isError()
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
parent
8e12e2814f
commit
8a44b72ac9
3 changed files with 2 additions and 4 deletions
|
|
@ -279,11 +279,11 @@ const platform_struct = PlatformStruct();
|
|||
|
||||
// TODO 0.16.0: Can we get away with this?
|
||||
pub fn isError(result: anytype) bool {
|
||||
if (@TypeOf(result) == c_int) {
|
||||
if (@typeInfo(@TypeOf(result)).int.signedness == .signed) {
|
||||
return result < 0;
|
||||
}
|
||||
|
||||
if (@TypeOf(result) == usize) {
|
||||
if (@typeInfo(@TypeOf(result)).int.signedness == .unsigned) {
|
||||
return switch (builtin.os.tag) {
|
||||
.linux => std.os.linux.errno(result) != .SUCCESS,
|
||||
else => @compileError("interop.isError() not implemented for current target!"),
|
||||
|
|
|
|||
|
|
@ -471,7 +471,6 @@ fn executeX11Cmd(log_file: *LogFile, allocator: std.mem.Allocator, io: std.Io, s
|
|||
while (ok != 0) {
|
||||
xcb = interop.xcb.xcb_connect(null, null);
|
||||
ok = interop.xcb.xcb_connection_has_error(xcb);
|
||||
// TODO 0.16.0: Does this work?
|
||||
std.posix.kill(pid, @enumFromInt(0)) catch |e| {
|
||||
if (e == error.ProcessNotFound and ok != 0) return error.XcbConnectionFailed;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2263,7 +2263,6 @@ fn getBatteryPercentage(io: std.Io, battery_id: []const u8) !u8 {
|
|||
defer battery_file.close(io);
|
||||
|
||||
var buffer: [8]u8 = undefined;
|
||||
// TODO 0.16.0: Check if that works
|
||||
const bytes_read = try battery_file.readStreaming(io, &.{&buffer});
|
||||
const capacity_str = buffer[0..bytes_read];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue