Remove TODOs & fix bug in interop.isError()

Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
AnErrupTion 2026-04-25 13:33:03 +02:00
commit 8a44b72ac9
No known key found for this signature in database
3 changed files with 2 additions and 4 deletions

View file

@ -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!"),

View file

@ -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;
};

View file

@ -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];