From 5919831529418ddf019b69e13ccccfce64837638 Mon Sep 17 00:00:00 2001 From: Luna Date: Mon, 30 Mar 2020 16:01:22 -0300 Subject: [PATCH] Stop using mem.len on array --- lib/std/net.zig | 8 +++++--- 1 file 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); }; }