aboutsummaryrefslogtreecommitdiff
path: root/lib/std/net.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-06-03 16:02:23 +0300
committerVeikka Tuominen <git@vexu.eu>2022-06-03 20:21:20 +0300
commit6d44c0a16c90a13cb3507751e2015edf51c642cf (patch)
tree6dfa9b43c776a3a34fad7aedada8b76b5eac5ac2 /lib/std/net.zig
parent1a7b4ddeaedb81255cfa8907958c3cf09dd340ee (diff)
downloadzig-6d44c0a16c90a13cb3507751e2015edf51c642cf.tar.gz
zig-6d44c0a16c90a13cb3507751e2015edf51c642cf.zip
std: update tests to stage2 semantics
Diffstat (limited to 'lib/std/net.zig')
-rw-r--r--lib/std/net.zig12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/std/net.zig b/lib/std/net.zig
index 0853a08c53..2bd3e6cfb1 100644
--- a/lib/std/net.zig
+++ b/lib/std/net.zig
@@ -1141,18 +1141,20 @@ fn linuxLookupNameFromHosts(
};
defer file.close();
- const stream = std.io.bufferedReader(file.reader()).reader();
+ var buffered_reader = std.io.bufferedReader(file.reader());
+ const reader = buffered_reader.reader();
var line_buf: [512]u8 = undefined;
- while (stream.readUntilDelimiterOrEof(&line_buf, '\n') catch |err| switch (err) {
+ while (reader.readUntilDelimiterOrEof(&line_buf, '\n') catch |err| switch (err) {
error.StreamTooLong => blk: {
- // Skip to the delimiter in the stream, to fix parsing
- try stream.skipUntilDelimiterOrEof('\n');
+ // Skip to the delimiter in the reader, to fix parsing
+ try reader.skipUntilDelimiterOrEof('\n');
// Use the truncated line. A truncated comment or hostname will be handled correctly.
break :blk &line_buf;
},
else => |e| return e,
}) |line| {
- const no_comment_line = mem.split(u8, line, "#").next().?;
+ var split_it = mem.split(u8, line, "#");
+ const no_comment_line = split_it.next().?;
var line_it = mem.tokenize(u8, no_comment_line, " \t");
const ip_text = line_it.next() orelse continue;