From 6261c1373168b265047db5704d9d0fd5f2e458f2 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 26 Apr 2023 13:57:08 -0700 Subject: update codebase to use `@memset` and `@memcpy` --- lib/std/mem/Allocator.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/std/mem') diff --git a/lib/std/mem/Allocator.zig b/lib/std/mem/Allocator.zig index b402fab3fa..5110534ed4 100644 --- a/lib/std/mem/Allocator.zig +++ b/lib/std/mem/Allocator.zig @@ -307,14 +307,14 @@ pub fn free(self: Allocator, memory: anytype) void { /// Copies `m` to newly allocated memory. Caller owns the memory. pub fn dupe(allocator: Allocator, comptime T: type, m: []const T) ![]T { const new_buf = try allocator.alloc(T, m.len); - mem.copy(T, new_buf, m); + @memcpy(new_buf, m); return new_buf; } /// Copies `m` to newly allocated memory, with a null-terminated element. Caller owns the memory. pub fn dupeZ(allocator: Allocator, comptime T: type, m: []const T) ![:0]T { const new_buf = try allocator.alloc(T, m.len + 1); - mem.copy(T, new_buf, m); + @memcpy(new_buf[0..m.len], m); new_buf[m.len] = 0; return new_buf[0..m.len :0]; } -- cgit v1.2.3