diff options
| author | Luna <git@l4.pm> | 2020-03-30 16:01:22 -0300 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-06-02 14:56:06 -0400 |
| commit | 5919831529418ddf019b69e13ccccfce64837638 (patch) | |
| tree | 1cc9a4d6b5b1cc784cfff611d095d45f2eccf66a | |
| parent | 901aab8761daa5c2dae5e470d51f5b3bf76e2b78 (diff) | |
| download | zig-5919831529418ddf019b69e13ccccfce64837638.tar.gz zig-5919831529418ddf019b69e13ccccfce64837638.zip | |
Stop using mem.len on array
| -rw-r--r-- | lib/std/net.zig | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/std/net.zig b/lib/std/net.zig index 78ed8bc913..011149f09b 100644 --- a/lib/std/net.zig +++ b/lib/std/net.zig @@ -273,10 +273,12 @@ pub const Address = extern union { } var resolved_scope_id: u32 = 0; - if (std.mem.len(scope_id_value) > 0) { - resolved_scope_id = std.fmt.parseInt(u32, &scope_id_value, 10) catch |err| blk: { + std.debug.warn("scope_id_value {} len {}\n", .{ scope_id_value, std.mem.len(scope_id_value) }); + if (scope_id_index > 0) { + const scope_id_str = scope_id_value[0..scope_id_index]; + resolved_scope_id = std.fmt.parseInt(u32, scope_id_str, 10) catch |err| blk: { if (err != error.InvalidCharacter) return err; - break :blk try if_nametoindex(&scope_id_value); + break :blk try if_nametoindex(scope_id_str); }; } |
