refactor(shell): remove the 'allocator' parameter
This commit is contained in:
@@ -23,7 +23,7 @@ pub fn getShell(allocator: std.mem.Allocator) ![]u8 {
|
|||||||
_ = try child.wait();
|
_ = try child.wait();
|
||||||
|
|
||||||
if (std.mem.indexOf(u8, shell, "bash") != null) {
|
if (std.mem.indexOf(u8, shell, "bash") != null) {
|
||||||
const bash_version = parseBashVersion(allocator, output);
|
const bash_version = parseBashVersion(output);
|
||||||
defer allocator.free(output);
|
defer allocator.free(output);
|
||||||
return try std.fmt.allocPrint(allocator, "{s} {s}", .{ "bash", bash_version.? });
|
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;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parseBashVersion(allocator: std.mem.Allocator, shell_version_output: []u8) ?[]u8 {
|
fn parseBashVersion(shell_version_output: []u8) ?[]u8 {
|
||||||
_ = allocator;
|
|
||||||
const end_index = std.mem.indexOf(u8, shell_version_output, "(");
|
const end_index = std.mem.indexOf(u8, shell_version_output, "(");
|
||||||
if (end_index == null) return null;
|
if (end_index == null) return null;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ pub fn getShell(allocator: std.mem.Allocator) ![]u8 {
|
|||||||
_ = try child.wait();
|
_ = try child.wait();
|
||||||
|
|
||||||
if (std.mem.indexOf(u8, shell, "bash") != null) {
|
if (std.mem.indexOf(u8, shell, "bash") != null) {
|
||||||
const bash_version = parseBashVersion(allocator, output);
|
const bash_version = parseBashVersion(output);
|
||||||
defer allocator.free(output);
|
defer allocator.free(output);
|
||||||
return try std.fmt.allocPrint(allocator, "{s} {s}", .{ "bash", bash_version.? });
|
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;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parseBashVersion(allocator: std.mem.Allocator, shell_version_output: []u8) ?[]u8 {
|
fn parseBashVersion(shell_version_output: []u8) ?[]u8 {
|
||||||
_ = allocator;
|
|
||||||
const end_index = std.mem.indexOf(u8, shell_version_output, "(");
|
const end_index = std.mem.indexOf(u8, shell_version_output, "(");
|
||||||
if (end_index == null) return null;
|
if (end_index == null) return null;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user