refactor(shell): remove the 'allocator' parameter

This commit is contained in:
utox39
2025-08-05 23:13:42 +02:00
parent 2d1c7506d8
commit eb477e5154
2 changed files with 4 additions and 6 deletions

View File

@@ -23,7 +23,7 @@ pub fn getShell(allocator: std.mem.Allocator) ![]u8 {
_ = try child.wait();
if (std.mem.indexOf(u8, shell, "bash") != null) {
const bash_version = parseBashVersion(allocator, output);
const bash_version = parseBashVersion(output);
defer allocator.free(output);
return try std.fmt.allocPrint(allocator, "{s} {s}", .{ "bash", bash_version.? });
}
@@ -31,8 +31,7 @@ pub fn getShell(allocator: std.mem.Allocator) ![]u8 {
return output;
}
fn parseBashVersion(allocator: std.mem.Allocator, shell_version_output: []u8) ?[]u8 {
_ = allocator;
fn parseBashVersion(shell_version_output: []u8) ?[]u8 {
const end_index = std.mem.indexOf(u8, shell_version_output, "(");
if (end_index == null) return null;

View File

@@ -26,7 +26,7 @@ pub fn getShell(allocator: std.mem.Allocator) ![]u8 {
_ = try child.wait();
if (std.mem.indexOf(u8, shell, "bash") != null) {
const bash_version = parseBashVersion(allocator, output);
const bash_version = parseBashVersion(output);
defer allocator.free(output);
return try std.fmt.allocPrint(allocator, "{s} {s}", .{ "bash", bash_version.? });
}
@@ -34,8 +34,7 @@ pub fn getShell(allocator: std.mem.Allocator) ![]u8 {
return output;
}
fn parseBashVersion(allocator: std.mem.Allocator, shell_version_output: []u8) ?[]u8 {
_ = allocator;
fn parseBashVersion(shell_version_output: []u8) ?[]u8 {
const end_index = std.mem.indexOf(u8, shell_version_output, "(");
if (end_index == null) return null;