diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-04-29 00:19:55 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-29 00:19:55 -0700 |
| commit | d65b42e07caa00dfe2f2fbf221c593ce57882784 (patch) | |
| tree | 7926cbea1499e0affe930bf6d7455dc24adf014e /lib/std/fs/path.zig | |
| parent | fd6200eda6d4fe19c34a59430a88a9ce38d6d7a4 (diff) | |
| parent | fa200ca0cad2705bad40eb723dedf4e3bf11f2ff (diff) | |
| download | zig-d65b42e07caa00dfe2f2fbf221c593ce57882784.tar.gz zig-d65b42e07caa00dfe2f2fbf221c593ce57882784.zip | |
Merge pull request #15481 from ziglang/use-mem-intrinsics
actually use the new memory intrinsics
Diffstat (limited to 'lib/std/fs/path.zig')
| -rw-r--r-- | lib/std/fs/path.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/std/fs/path.zig b/lib/std/fs/path.zig index beb386f92c..4f3e05cd59 100644 --- a/lib/std/fs/path.zig +++ b/lib/std/fs/path.zig @@ -79,7 +79,7 @@ fn joinSepMaybeZ(allocator: Allocator, separator: u8, comptime sepPredicate: fn const buf = try allocator.alloc(u8, total_len); errdefer allocator.free(buf); - mem.copy(u8, buf, paths[first_path_index]); + @memcpy(buf[0..paths[first_path_index].len], paths[first_path_index]); var buf_index: usize = paths[first_path_index].len; var prev_path = paths[first_path_index]; assert(prev_path.len > 0); @@ -94,7 +94,7 @@ fn joinSepMaybeZ(allocator: Allocator, separator: u8, comptime sepPredicate: fn buf_index += 1; } const adjusted_path = if (prev_sep and this_sep) this_path[1..] else this_path; - mem.copy(u8, buf[buf_index..], adjusted_path); + @memcpy(buf[buf_index..][0..adjusted_path.len], adjusted_path); buf_index += adjusted_path.len; prev_path = this_path; } @@ -631,7 +631,7 @@ pub fn resolveWindows(allocator: Allocator, paths: []const []const u8) ![]u8 { real_result[i..][0..3].* = "..\\".*; i += 3; } - mem.copy(u8, real_result[i..], result.items); + @memcpy(real_result[i..][0..result.items.len], result.items); return real_result; } } @@ -710,7 +710,7 @@ pub fn resolvePosix(allocator: Allocator, paths: []const []const u8) Allocator.E real_result[i..][0..3].* = "../".*; i += 3; } - mem.copy(u8, real_result[i..], result.items); + @memcpy(real_result[i..][0..result.items.len], result.items); return real_result; } } @@ -1106,7 +1106,7 @@ pub fn relativeWindows(allocator: Allocator, from: []const u8, to: []const u8) ! while (rest_it.next()) |to_component| { result[result_index] = '\\'; result_index += 1; - mem.copy(u8, result[result_index..], to_component); + @memcpy(result[result_index..][0..to_component.len], to_component); result_index += to_component.len; } @@ -1151,7 +1151,7 @@ pub fn relativePosix(allocator: Allocator, from: []const u8, to: []const u8) ![] return allocator.realloc(result, result_index - 1); } - mem.copy(u8, result[result_index..], to_rest); + @memcpy(result[result_index..][0..to_rest.len], to_rest); return result; } |
