diff options
Diffstat (limited to 'lib/std/os')
| -rw-r--r-- | lib/std/os/linux/bpf.zig | 2 | ||||
| -rw-r--r-- | lib/std/os/linux/io_uring.zig | 10 | ||||
| -rw-r--r-- | lib/std/os/linux/tls.zig | 4 | ||||
| -rw-r--r-- | lib/std/os/test.zig | 2 | ||||
| -rw-r--r-- | lib/std/os/uefi/protocols/device_path_protocol.zig | 2 | ||||
| -rw-r--r-- | lib/std/os/windows.zig | 14 |
6 files changed, 17 insertions, 17 deletions
diff --git a/lib/std/os/linux/bpf.zig b/lib/std/os/linux/bpf.zig index db6473d673..63b669acd5 100644 --- a/lib/std/os/linux/bpf.zig +++ b/lib/std/os/linux/bpf.zig @@ -1631,7 +1631,7 @@ test "map lookup, update, and delete" { const status = try map_get_next_key(map, &lookup_key, &next_key); try expectEqual(status, true); try expectEqual(next_key, key); - std.mem.copy(u8, &lookup_key, &next_key); + lookup_key = next_key; const status2 = try map_get_next_key(map, &lookup_key, &next_key); try expectEqual(status2, false); diff --git a/lib/std/os/linux/io_uring.zig b/lib/std/os/linux/io_uring.zig index 20248fd65f..b7467d765f 100644 --- a/lib/std/os/linux/io_uring.zig +++ b/lib/std/os/linux/io_uring.zig @@ -1855,8 +1855,8 @@ test "write_fixed/read_fixed" { var raw_buffers: [2][11]u8 = undefined; // First buffer will be written to the file. - std.mem.set(u8, &raw_buffers[0], 'z'); - std.mem.copy(u8, &raw_buffers[0], "foobar"); + @memset(&raw_buffers[0], 'z'); + raw_buffers[0][0.."foobar".len].* = "foobar".*; var buffers = [2]os.iovec{ .{ .iov_base = &raw_buffers[0], .iov_len = raw_buffers[0].len }, @@ -2966,7 +2966,7 @@ test "provide_buffers: read" { // Provide 1 buffer again // Deliberately put something we don't expect in the buffers - mem.set(u8, mem.sliceAsBytes(&buffers), 42); + @memset(mem.sliceAsBytes(&buffers), 42); const reprovided_buffer_id = 2; @@ -3155,7 +3155,7 @@ test "provide_buffers: accept/connect/send/recv" { // Do 4 recv which should consume all buffers // Deliberately put something we don't expect in the buffers - mem.set(u8, mem.sliceAsBytes(&buffers), 1); + @memset(mem.sliceAsBytes(&buffers), 1); var i: usize = 0; while (i < buffers.len) : (i += 1) { @@ -3235,7 +3235,7 @@ test "provide_buffers: accept/connect/send/recv" { // Final recv which should work // Deliberately put something we don't expect in the buffers - mem.set(u8, mem.sliceAsBytes(&buffers), 1); + @memset(mem.sliceAsBytes(&buffers), 1); { var sqe = try ring.recv(0xdfdfdfdf, socket_test_harness.client, .{ .buffer_selection = .{ .group_id = group_id, .len = buffer_len } }, 0); diff --git a/lib/std/os/linux/tls.zig b/lib/std/os/linux/tls.zig index cffdec0424..311e5609e8 100644 --- a/lib/std/os/linux/tls.zig +++ b/lib/std/os/linux/tls.zig @@ -275,7 +275,7 @@ inline fn alignPtrCast(comptime T: type, ptr: [*]u8) *T { /// architecture-specific value of the thread-pointer register pub fn prepareTLS(area: []u8) usize { // Clear the area we're going to use, just to be safe - mem.set(u8, area, 0); + @memset(area, 0); // Prepare the DTV const dtv = alignPtrCast(DTV, area.ptr + tls_image.dtv_offset); dtv.entries = 1; @@ -287,7 +287,7 @@ pub fn prepareTLS(area: []u8) usize { .VariantII => area.ptr + tls_image.tcb_offset, }; // Copy the data - mem.copy(u8, area[tls_image.data_offset..], tls_image.init_data); + @memcpy(area[tls_image.data_offset..][0..tls_image.init_data.len], tls_image.init_data); // Return the corrected value (if needed) for the tp register. // Overflow here is not a problem, the pointer arithmetic involving the tp diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig index 682bd4f6f8..f694ea277a 100644 --- a/lib/std/os/test.zig +++ b/lib/std/os/test.zig @@ -587,7 +587,7 @@ test "mmap" { try testing.expect(mem.eql(u8, data, &[_]u8{0x00} ** 1234)); // Make sure the memory is writeable as requested - std.mem.set(u8, data, 0x55); + @memset(data, 0x55); try testing.expect(mem.eql(u8, data, &[_]u8{0x55} ** 1234)); } diff --git a/lib/std/os/uefi/protocols/device_path_protocol.zig b/lib/std/os/uefi/protocols/device_path_protocol.zig index fb497a79da..2365b0cb2e 100644 --- a/lib/std/os/uefi/protocols/device_path_protocol.zig +++ b/lib/std/os/uefi/protocols/device_path_protocol.zig @@ -48,7 +48,7 @@ pub const DevicePathProtocol = extern struct { // DevicePathProtocol for the extra node before the end var buf = try allocator.alloc(u8, path_size + 2 * (path.len + 1) + @sizeOf(DevicePathProtocol)); - mem.copy(u8, buf, @ptrCast([*]const u8, self)[0..path_size]); + @memcpy(buf[0..path_size.len], @ptrCast([*]const u8, self)[0..path_size]); // Pointer to the copy of the end node of the current chain, which is - 4 from the buffer // as the end node itself is 4 bytes (type: u8 + subtype: u8 + length: u16). diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index 23139c9f92..6d654f1c20 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -754,7 +754,7 @@ pub fn CreateSymbolicLink( .Flags = if (dir) |_| SYMLINK_FLAG_RELATIVE else 0, }; - std.mem.copy(u8, buffer[0..], std.mem.asBytes(&symlink_data)); + @memcpy(buffer[0..@sizeOf(SYMLINK_DATA)], std.mem.asBytes(&symlink_data)); @memcpy(buffer[@sizeOf(SYMLINK_DATA)..][0 .. target_path.len * 2], @ptrCast([*]const u8, target_path)); const paths_start = @sizeOf(SYMLINK_DATA) + target_path.len * 2; @memcpy(buffer[paths_start..][0 .. target_path.len * 2], @ptrCast([*]const u8, target_path)); @@ -1208,8 +1208,8 @@ pub fn GetFinalPathNameByHandle( if (out_buffer.len < drive_letter.len + file_name_u16.len) return error.NameTooLong; - mem.copy(u16, out_buffer, drive_letter); - mem.copy(u16, out_buffer[drive_letter.len..], file_name_u16); + @memcpy(out_buffer[0..drive_letter.len], drive_letter); + mem.copyForwards(u16, out_buffer[drive_letter.len..][0..file_name_u16.len], file_name_u16); const total_len = drive_letter.len + file_name_u16.len; // Validate that DOS does not contain any spurious nul bytes. @@ -2012,7 +2012,7 @@ pub fn sliceToPrefixedFileW(s: []const u8) !PathSpace { } const prefix_u16 = [_]u16{ '\\', '?', '?', '\\' }; const start_index = if (prefix_index > 0 or !std.fs.path.isAbsolute(s)) 0 else blk: { - mem.copy(u16, path_space.data[0..], prefix_u16[0..]); + path_space.data[0..prefix_u16.len].* = prefix_u16; break :blk prefix_u16.len; }; path_space.len = start_index + try std.unicode.utf8ToUtf16Le(path_space.data[start_index..], s); @@ -2025,7 +2025,7 @@ pub fn sliceToPrefixedFileW(s: []const u8) !PathSpace { std.debug.assert(temp_path.len == path_space.len); temp_path.data[path_space.len] = 0; path_space.len = prefix_u16.len + try getFullPathNameW(&temp_path.data, path_space.data[prefix_u16.len..]); - mem.copy(u16, &path_space.data, &prefix_u16); + path_space.data[0..prefix_u16.len].* = prefix_u16; std.debug.assert(path_space.data[path_space.len] == 0); return path_space; } @@ -2053,12 +2053,12 @@ pub fn wToPrefixedFileW(s: []const u16) !PathSpace { const start_index = if (mem.startsWith(u16, s, &[_]u16{ '\\', '?' })) 0 else blk: { const prefix = [_]u16{ '\\', '?', '?', '\\' }; - mem.copy(u16, path_space.data[0..], &prefix); + path_space.data[0..prefix.len].* = prefix; break :blk prefix.len; }; path_space.len = start_index + s.len; if (path_space.len > path_space.data.len) return error.NameTooLong; - mem.copy(u16, path_space.data[start_index..], s); + @memcpy(path_space.data[start_index..][0..s.len], s); // > File I/O functions in the Windows API convert "/" to "\" as part of // > converting the name to an NT-style name, except when using the "\\?\" // > prefix as detailed in the following sections. |
