Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
bens committed Mar 14, 2024
1 parent 273fa8a commit 03f50b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion util/os/linux.zig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn getCpuName() ![]const u8 {
_ = try file.read(&cpu_name_buffer);

const needle = "model name";
const start = if (mem.indexOf(u8, &buf, needle)) |pos|
const start = if (mem.indexOf(u8, &cpu_name_buffer, needle)) |pos|
pos + needle.len
else
return error.CouldNotFindCpuName;
Expand Down
8 changes: 4 additions & 4 deletions util/platform.zig
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ const platform = @tagName(builtin.os.tag) ++ " " ++ @tagName(builtin.cpu.arch);

pub fn getSystemInfo(allocator: std.mem.Allocator) !OsInfo {
return switch (builtin.os.tag) {
.linux => try linux(allocator),
.linux => try linux(),
.macos => try macos(allocator),
.windows => try windows(allocator),
else => error.UnsupportedOs,
};
}

pub fn linux(allocator: std.mem.Allocator) !OsInfo {
pub fn linux() !OsInfo {
return OsInfo{
.platform = platform,
.cpu = try lnx.getCpuName(allocator),
.cpu = try lnx.getCpuName(),
.cpu_cores = try lnx.getCpuCores(),
.memory_total = try lnx.getTotalMemory(),
};
Expand All @@ -69,7 +69,7 @@ pub fn windows(allocator: std.mem.Allocator) !OsInfo {
}

test "OsInfo" {
const sysinfo = getSystemInfo(std.testing.allocator);
const sysinfo = try getSystemInfo(std.testing.allocator);
try std.testing.expect(sysinfo.platform.len != 0);
try std.testing.expect(sysinfo.cpu.len != 0);
try std.testing.expect(0 < sysinfo.cpu_cores);
Expand Down

0 comments on commit 03f50b2

Please sign in to comment.