Merge pull request #451 from SebastianKeller/fix_build_master

Fix build on zig master (0.10.0-dev.500+66cf011aa)
This commit is contained in:
Auguste Rame 2022-02-01 19:16:23 -05:00 committed by GitHub
commit 655a013db2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1654,16 +1654,13 @@ pub fn main() anyerror!void {
defer analysis.deinit(); defer analysis.deinit();
// Check arguments. // Check arguments.
var args_it = std.process.args(); var args_it = try std.process.ArgIterator.initWithAllocator(allocator);
defer args_it.deinit(); defer args_it.deinit();
const prog_name = (try args_it.next(allocator)) orelse @panic("Could not find self argument"); if(!args_it.skip()) @panic("Could not find self argument");
allocator.free(prog_name);
var config_path: ?[]const u8 = null; var config_path: ?[]const u8 = null;
var next_arg_config_path = false; var next_arg_config_path = false;
while (try args_it.next(allocator)) |arg| { while (args_it.next()) |arg| {
defer allocator.free(arg);
if (next_arg_config_path) { if (next_arg_config_path) {
config_path = try allocator.dupe(u8, arg); config_path = try allocator.dupe(u8, arg);
next_arg_config_path = false; next_arg_config_path = false;
@ -1684,6 +1681,7 @@ pub fn main() anyerror!void {
std.os.exit(1); std.os.exit(1);
} }
} }
if (next_arg_config_path) { if (next_arg_config_path) {
std.debug.print("Expected configuration file path after --config-path argument\n", .{}); std.debug.print("Expected configuration file path after --config-path argument\n", .{});
return; return;