| ... | @@ -270,11 +270,9 @@ const FmtError = error{ | ... | @@ -270,11 +270,9 @@ const FmtError = error{ |
| 270 | FileBusy, | 270 | FileBusy, |
| 271 | } || fs.File.OpenError; | 271 | } || fs.File.OpenError; |
| 272 | | 272 | |
| 273 | fn fmtPath(fmt: *Fmt, file_path_ref: []const u8, check_mode: bool) FmtError!void { | 273 | fn fmtPath(fmt: *Fmt, file_path: []const u8, check_mode: bool) FmtError!void { |
| 274 | const file_path = try std.mem.dupe(fmt.allocator, u8, file_path_ref); | 274 | if (fmt.seen.exists(file_path)) return; |
| 275 | defer fmt.allocator.free(file_path); | 275 | try fmt.seen.put(file_path); |
| 276 | | | |
| 277 | if (try fmt.seen.put(file_path, {})) |_| return; | | |
| 278 | | 276 | |
| 279 | const source_code = io.readFileAlloc(fmt.allocator, file_path) catch |err| switch (err) { | 277 | const source_code = io.readFileAlloc(fmt.allocator, file_path) catch |err| switch (err) { |
| 280 | error.IsDir, error.AccessDenied => { | 278 | error.IsDir, error.AccessDenied => { |
| ... | @@ -341,7 +339,7 @@ const Fmt = struct { | ... | @@ -341,7 +339,7 @@ const Fmt = struct { |
| 341 | color: errmsg.Color, | 339 | color: errmsg.Color, |
| 342 | allocator: *mem.Allocator, | 340 | allocator: *mem.Allocator, |
| 343 | | 341 | |
| 344 | const SeenMap = std.StringHashMap(void); | 342 | const SeenMap = std.BufSet; |
| 345 | }; | 343 | }; |
| 346 | | 344 | |
| 347 | fn printErrMsgToFile( | 345 | fn printErrMsgToFile( |