| ... | @@ -90,10 +90,8 @@ fn findPrefix(cache: *const Cache, file_path: []const u8) !PrefixedPath { | ... | @@ -90,10 +90,8 @@ fn findPrefix(cache: *const Cache, file_path: []const u8) !PrefixedPath { |
| 90 | fn findPrefixResolved(cache: *const Cache, resolved_path: []u8) !PrefixedPath { | 90 | fn findPrefixResolved(cache: *const Cache, resolved_path: []u8) !PrefixedPath { |
| 91 | const gpa = cache.gpa; | 91 | const gpa = cache.gpa; |
| 92 | const cwd = cache.cwd; | 92 | const cwd = cache.cwd; |
| 93 | const prefixes_slice = cache.prefixes(); | 93 | for (cache.prefixes(), 0..) |prefix, i| { |
| 94 | var i: u8 = 1; // Start at 1 to skip over checking the null prefix. | 94 | const p = prefix.path orelse continue; |
| 95 | while (i < prefixes_slice.len) : (i += 1) { | | |
| 96 | const p = prefixes_slice[i].path.?; | | |
| 97 | const sub_path = getPrefixSubpath(gpa, cwd, p, resolved_path) catch |err| switch (err) { | 95 | const sub_path = getPrefixSubpath(gpa, cwd, p, resolved_path) catch |err| switch (err) { |
| 98 | error.NotASubPath => continue, | 96 | error.NotASubPath => continue, |
| 99 | else => |e| return e, | 97 | else => |e| return e, |
| ... | @@ -101,7 +99,7 @@ fn findPrefixResolved(cache: *const Cache, resolved_path: []u8) !PrefixedPath { | ... | @@ -101,7 +99,7 @@ fn findPrefixResolved(cache: *const Cache, resolved_path: []u8) !PrefixedPath { |
| 101 | // Free the resolved path since we're not going to return it | 99 | // Free the resolved path since we're not going to return it |
| 102 | gpa.free(resolved_path); | 100 | gpa.free(resolved_path); |
| 103 | return .{ | 101 | return .{ |
| 104 | .prefix = i, | 102 | .prefix = @intCast(i), |
| 105 | .sub_path = sub_path, | 103 | .sub_path = sub_path, |
| 106 | }; | 104 | }; |
| 107 | } | 105 | } |