diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-06-07 19:14:07 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-06-07 21:27:07 +0300 |
| commit | 413577c881963559f7f357bfd90f4ade6d6de20d (patch) | |
| tree | 10ff3de8d476b129e72f7f6641a937eb26c8592e /lib/std/net.zig | |
| parent | 6de9eea7bce4023ae150fb5b4d417d66b9bf13fb (diff) | |
| download | zig-413577c881963559f7f357bfd90f4ade6d6de20d.tar.gz zig-413577c881963559f7f357bfd90f4ade6d6de20d.zip | |
std: adjust for stage2 semantics
Diffstat (limited to 'lib/std/net.zig')
| -rw-r--r-- | lib/std/net.zig | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/std/net.zig b/lib/std/net.zig index 2bd3e6cfb1..235ad8496a 100644 --- a/lib/std/net.zig +++ b/lib/std/net.zig @@ -1342,7 +1342,8 @@ fn getResolvConf(allocator: mem.Allocator, rc: *ResolvConf) !void { }; defer file.close(); - const stream = std.io.bufferedReader(file.reader()).reader(); + var buf_reader = std.io.bufferedReader(file.reader()); + const stream = buf_reader.reader(); var line_buf: [512]u8 = undefined; while (stream.readUntilDelimiterOrEof(&line_buf, '\n') catch |err| switch (err) { error.StreamTooLong => blk: { @@ -1353,7 +1354,10 @@ fn getResolvConf(allocator: mem.Allocator, rc: *ResolvConf) !void { }, else => |e| return e, }) |line| { - const no_comment_line = mem.split(u8, line, "#").next().?; + const no_comment_line = no_comment_line: { + var split = mem.split(u8, line, "#"); + break :no_comment_line split.next().?; + }; var line_it = mem.tokenize(u8, no_comment_line, " \t"); const token = line_it.next() orelse continue; @@ -1363,7 +1367,8 @@ fn getResolvConf(allocator: mem.Allocator, rc: *ResolvConf) !void { const name = colon_it.next().?; const value_txt = colon_it.next() orelse continue; const value = std.fmt.parseInt(u8, value_txt, 10) catch |err| switch (err) { - error.Overflow => 255, + // TODO https://github.com/ziglang/zig/issues/11812 + error.Overflow => @as(u8, 255), error.InvalidCharacter => continue, }; if (mem.eql(u8, name, "ndots")) { |
