Merge pull request #24 from kirillrdy/main

Use the new `std.fs.File.read` function.
This commit is contained in:
utox39
2025-10-15 14:46:02 +02:00
committed by GitHub
2 changed files with 2 additions and 4 deletions

View File

@@ -122,8 +122,7 @@ pub fn getWindowManagerInfo(allocator: std.mem.Allocator) ![]const u8 {
// NOTE: https://stackoverflow.com/questions/23534263/what-is-the-maximum-allowed-limit-on-the-length-of-a-process-name
var file_buf: [16]u8 = undefined;
var reader = std.fs.File.Reader.init(file, &file_buf);
const read = try reader.read(&file_buf);
const read = try file.read(&file_buf);
const proc_name = file_buf[0..read];
const proc_name_trimmed = std.mem.trim(u8, proc_name, "\n");

View File

@@ -119,8 +119,7 @@ pub fn readFile(allocator: std.mem.Allocator, file: std.fs.File, size: usize) ![
var file_buf = try allocator.alloc(u8, size);
defer allocator.free(file_buf);
var reader = std.fs.File.Reader.init(file, file_buf);
const read = try reader.read(file_buf);
const read = try file.read(file_buf);
const data = file_buf[0..read];