diff --git a/build.zig b/build.zig index 9c7c12aed..730a09793 100644 --- a/build.zig +++ b/build.zig @@ -19,7 +19,7 @@ const Version = @import("src/build/Version.zig"); // but we liberally update it. In the future, we'll be more careful about // using released versions so that package managers can integrate better. comptime { - const required_zig = "0.12.0-dev.983+78f2ae7f2"; + const required_zig = "0.12.0-dev.1754+2a3226453"; const current_zig = builtin.zig_version; const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable; if (current_zig.order(min_zig) == .lt) { @@ -875,7 +875,7 @@ fn benchSteps( ) !void { // Open the directory ./src/bench const c_dir_path = (comptime root()) ++ "/src/bench"; - var c_dir = try fs.openIterableDirAbsolute(c_dir_path, .{}); + var c_dir = try fs.openDirAbsolute(c_dir_path, .{ .iterate = true }); defer c_dir.close(); // Go through and add each as a step @@ -918,7 +918,7 @@ fn conformanceSteps( // Open the directory ./conformance const c_dir_path = (comptime root()) ++ "/conformance"; - var c_dir = try fs.openIterableDirAbsolute(c_dir_path, .{}); + var c_dir = try fs.openDirAbsolute(c_dir_path, .{ .iterate = true }); defer c_dir.close(); // Go through and add each as a step diff --git a/build.zig.zon b/build.zig.zon index fc1ecb2f9..a1f3c1497 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -5,12 +5,12 @@ .dependencies = .{ // Zig libs .libxev = .{ - .url = "https://github.com/mitchellh/libxev/archive/a5f8b9851c18d93a79a154004fb0393a1ec55c65.tar.gz", - .hash = "1220589dfd60060857bfcee53b0ee0e4175f764ae22d54e46054e2f81b63af1f6636", + .url = "https://github.com/mitchellh/libxev/archive/7eada4333c36b3e16f4dc2abad707149ef7b6de5.tar.gz", + .hash = "1220be2c7b3f3a07b9150720140c7038f454a9ce0cbc5d303767c1e4a50856ec1b01", }, .mach_glfw = .{ - .url = "https://github.com/hexops/mach-glfw/archive/16dc95cc7f74ebbbdd848d9a2c3cc4afc5717708.tar.gz", - .hash = "12202da6b8e9024c653f5d67f55a8065b401c42b3c08b69333d95400fe85d6019a59", + .url = "https://github.com/hexops/mach-glfw/archive/577220552e1b31c4496d2e0df2fb5fbc9287b966.tar.gz", + .hash = "12204779ba2f14b46f569110f774d5c3f48b7a105b6717e668bc410710bceae62072", }, .zig_objc = .{ .url = "https://github.com/mitchellh/zig-objc/archive/10e552bd37c2f61b9f570d5ceb145165c6f1854b.tar.gz", diff --git a/flake.lock b/flake.lock index 4064aea36..44bbec12e 100644 --- a/flake.lock +++ b/flake.lock @@ -257,11 +257,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1700439807, - "narHash": "sha256-8JOqjnlOsJWryzfZ61Zz0hfCW2m6mu8JnW0Sb/EWB3I=", + "lastModified": 1701259715, + "narHash": "sha256-k323e7C01XaVyvzprw6Lay51V1quKzkPOsrbEtkV390=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "0a3f3e96cbb0df6c70dd6c957c0fde90d8d57a78", + "rev": "3b7938f44a345b12f70f0e34d5492b75e4005767", "type": "github" }, "original": { diff --git a/nix/zig_cache_hash.nix b/nix/zig_cache_hash.nix index 3163c1ac9..781f50358 100644 --- a/nix/zig_cache_hash.nix +++ b/nix/zig_cache_hash.nix @@ -1,3 +1,3 @@ # This file is auto-generated! check build-support/check-zig-cache-hash.sh for # more details. -"sha256-bQ81e0vJBSLkVJ3a3nLraVc/JeG77xGckuARmu81DqI=" +"sha256-Dn9KRvSteFvHWy6ULEQbRIQZf+bVfpVYWsImGm32qeI=" diff --git a/pkg/fontconfig/common.zig b/pkg/fontconfig/common.zig index 3f3b22388..5562815db 100644 --- a/pkg/fontconfig/common.zig +++ b/pkg/fontconfig/common.zig @@ -89,7 +89,7 @@ pub const Property = enum { // Build our string var name: [replaced.len:0]u8 = undefined; - std.mem.copy(u8, &name, replaced); + @memcpy(&name, replaced); name[replaced.len] = 0; break :name &name; }; diff --git a/src/Command.zig b/src/Command.zig index afca6a564..b02a9bc78 100644 --- a/src/Command.zig +++ b/src/Command.zig @@ -374,9 +374,9 @@ pub fn expandPath(alloc: Allocator, cmd: []const u8) !?[]u8 { if (path_buf.len < path_len) return error.PathTooLong; // Copy in the full path - mem.copy(u8, &path_buf, search_path); + @memcpy(path_buf[0..search_path.len], search_path); path_buf[search_path.len] = std.fs.path.sep; - mem.copy(u8, path_buf[search_path.len + 1 ..], cmd); + @memcpy(path_buf[search_path.len + 1 ..][0..cmd.len], cmd); path_buf[path_len] = 0; const full_path = path_buf[0..path_len :0]; @@ -440,9 +440,9 @@ fn createNullDelimitedEnvMap(arena: mem.Allocator, env_map: *const EnvMap) ![:nu var i: usize = 0; while (it.next()) |pair| : (i += 1) { const env_buf = try arena.allocSentinel(u8, pair.key_ptr.len + pair.value_ptr.len + 1, 0); - mem.copy(u8, env_buf, pair.key_ptr.*); + @memcpy(env_buf[0..pair.key_ptr.len], pair.key_ptr.*); env_buf[pair.key_ptr.len] = '='; - mem.copy(u8, env_buf[pair.key_ptr.len + 1 ..], pair.value_ptr.*); + @memcpy(env_buf[pair.key_ptr.len + 1 ..], pair.value_ptr.*); envp_buf[i] = env_buf.ptr; } std.debug.assert(i == envp_count); diff --git a/src/Surface.zig b/src/Surface.zig index e4984ccbd..1ab1cf2e8 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -2501,7 +2501,7 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool .text => |data| { // For text we always allocate just because its easier to // handle all cases that way. - var buf = try self.alloc.alloc(u8, data.len); + const buf = try self.alloc.alloc(u8, data.len); defer self.alloc.free(buf); const text = configpkg.string.parse(buf, data) catch |err| { log.warn( diff --git a/src/cli/args.zig b/src/cli/args.zig index d8b670852..99e6f7aa1 100644 --- a/src/cli/args.zig +++ b/src/cli/args.zig @@ -204,14 +204,14 @@ fn parseIntoField( []const u8 => value: { const slice = value orelse return error.ValueRequired; const buf = try alloc.alloc(u8, slice.len); - mem.copy(u8, buf, slice); + @memcpy(buf, slice); break :value buf; }, [:0]const u8 => value: { const slice = value orelse return error.ValueRequired; const buf = try alloc.allocSentinel(u8, slice.len, 0); - mem.copy(u8, buf, slice); + @memcpy(buf, slice); buf[slice.len] = 0; break :value buf; }, @@ -709,7 +709,7 @@ pub fn LineIterator(comptime ReaderType: type) type { // Trim any whitespace around it const trim = std.mem.trim(u8, entry, whitespace); if (trim.len != entry.len) { - std.mem.copy(u8, entry, trim); + std.mem.copyForwards(u8, entry, trim); entry = entry[0..trim.len]; } @@ -737,9 +737,9 @@ pub fn LineIterator(comptime ReaderType: type) type { const len = key.len + value.len + 1; if (entry.len != len) { - std.mem.copy(u8, entry, key); + std.mem.copyForwards(u8, entry, key); entry[key.len] = '='; - std.mem.copy(u8, entry[key.len + 1 ..], value); + std.mem.copyForwards(u8, entry[key.len + 1 ..], value); entry = entry[0..len]; } } diff --git a/src/cli/list_themes.zig b/src/cli/list_themes.zig index bf763c5bf..37e515a42 100644 --- a/src/cli/list_themes.zig +++ b/src/cli/list_themes.zig @@ -43,7 +43,7 @@ pub fn run(alloc: Allocator) !u8 { const path = try std.fs.path.join(alloc, &.{ resources_dir, "themes" }); defer alloc.free(path); - var dir = try std.fs.cwd().openIterableDir(path, .{}); + var dir = try std.fs.cwd().openDir(path, .{ .iterate = true }); defer dir.close(); var walker = try dir.walk(alloc); diff --git a/src/config/Config.zig b/src/config/Config.zig index f49d21d82..a54ace398 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -2246,7 +2246,7 @@ pub const Keybinds = struct { const buf = try alloc.alloc(u8, value.len); copy = buf; - std.mem.copy(u8, buf, value); + @memcpy(buf, value); break :value buf; }; errdefer if (copy) |v| alloc.free(v); diff --git a/src/fastmem.zig b/src/fastmem.zig index b15b0e7aa..0e9a444ee 100644 --- a/src/fastmem.zig +++ b/src/fastmem.zig @@ -2,23 +2,23 @@ const std = @import("std"); const builtin = @import("builtin"); const assert = std.debug.assert; -/// Same as std.mem.copy but prefers libc memmove if it is available +/// Same as std.mem.copyForwards but prefers libc memmove if it is available /// because it is generally much faster. pub inline fn move(comptime T: type, dest: []T, source: []const T) void { if (builtin.link_libc) { _ = memmove(dest.ptr, source.ptr, source.len * @sizeOf(T)); } else { - std.mem.copy(T, dest, source); + std.mem.copyForwards(T, dest, source); } } -/// Same as std.mem.copy but prefers libc memcpy if it is available +/// Same as std.mem.copyForwards but prefers libc memcpy if it is available /// because it is generally much faster. pub inline fn copy(comptime T: type, dest: []T, source: []const T) void { if (builtin.link_libc) { _ = memcpy(dest.ptr, source.ptr, source.len * @sizeOf(T)); } else { - std.mem.copy(T, dest, source); + @memcpy(dest[0..source.len], source); } } diff --git a/src/font/sprite/canvas.zig b/src/font/sprite/canvas.zig index a13e1e50b..83d924008 100644 --- a/src/font/sprite/canvas.zig +++ b/src/font/sprite/canvas.zig @@ -390,7 +390,7 @@ const PixmanImpl = struct { var src_ptr = data.ptr; var i: usize = 0; while (i < height) : (i += 1) { - std.mem.copy(u8, dst_ptr, src_ptr[0 .. width * depth]); + @memcpy(dst_ptr[0 .. width * depth], src_ptr[0 .. width * depth]); dst_ptr = dst_ptr[width * depth ..]; src_ptr += @as(usize, @intCast(stride)); } diff --git a/src/os/homedir.zig b/src/os/homedir.zig index 809afea30..ab60cdf26 100644 --- a/src/os/homedir.zig +++ b/src/os/homedir.zig @@ -22,7 +22,7 @@ fn homeUnix(buf: []u8) !?[]u8 { // First: if we have a HOME env var, then we use that. if (std.os.getenv("HOME")) |result| { if (buf.len < result.len) return Error.BufferTooSmall; - std.mem.copy(u8, buf, result); + @memcpy(buf[0..result.len], result); return buf[0..result.len]; } @@ -46,7 +46,7 @@ fn homeUnix(buf: []u8) !?[]u8 { if (run.term == .Exited and run.term.Exited == 0) { const result = trimSpace(run.stdout); if (buf.len < result.len) return Error.BufferTooSmall; - std.mem.copy(u8, buf, result); + @memcpy(buf[0..result.len], result); return buf[0..result.len]; } } @@ -56,7 +56,7 @@ fn homeUnix(buf: []u8) !?[]u8 { const pw = try passwd.get(fba.allocator()); if (pw.home) |result| { if (buf.len < result.len) return Error.BufferTooSmall; - std.mem.copy(u8, buf, result); + @memcpy(buf[0..result.len], result); return buf[0..result.len]; } @@ -71,7 +71,7 @@ fn homeUnix(buf: []u8) !?[]u8 { if (run.term == .Exited and run.term.Exited == 0) { const result = trimSpace(run.stdout); if (buf.len < result.len) return Error.BufferTooSmall; - std.mem.copy(u8, buf, result); + @memcpy(buf[0..result.len], result); return buf[0..result.len]; } diff --git a/src/os/passwd.zig b/src/os/passwd.zig index a9bfb0e8a..8aaf5ed42 100644 --- a/src/os/passwd.zig +++ b/src/os/passwd.zig @@ -123,14 +123,14 @@ pub fn get(alloc: Allocator) !Entry { if (pw.pw_shell) |ptr| { const source = std.mem.sliceTo(ptr, 0); const sh = try alloc.alloc(u8, source.len); - std.mem.copy(u8, sh, source); + @memcpy(sh, source); result.shell = sh; } if (pw.pw_dir) |ptr| { const source = std.mem.sliceTo(ptr, 0); const dir = try alloc.alloc(u8, source.len); - std.mem.copy(u8, dir, source); + @memcpy(dir, source); result.home = dir; } diff --git a/src/pty.zig b/src/pty.zig index a482dc42b..f31d5f97d 100644 --- a/src/pty.zig +++ b/src/pty.zig @@ -132,7 +132,7 @@ const WindowsPty = struct { pub const Fd = windows.HANDLE; // Process-wide counter for pipe names - var pipe_name_counter = std.atomic.Atomic(u32).init(1); + var pipe_name_counter = std.atomic.Value(u32).init(1); out_pipe: windows.HANDLE, in_pipe: windows.HANDLE, diff --git a/src/termio/Exec.zig b/src/termio/Exec.zig index 9b4631a22..169228c63 100644 --- a/src/termio/Exec.zig +++ b/src/termio/Exec.zig @@ -762,7 +762,7 @@ const Subprocess = struct { // Copy it with a hyphen so its a login shell const argv0_buf = try alloc.alloc(u8, argv0.len + 1); argv0_buf[0] = '-'; - std.mem.copy(u8, argv0_buf[1..], argv0); + @memcpy(argv0_buf[1..], argv0); break :argv0 argv0_buf; } else null; @@ -2120,7 +2120,7 @@ const StreamHandler = struct { return; } - std.mem.copy(u8, &buf, title); + @memcpy(buf[0..title.len], title); buf[title.len] = 0; // Mark that we've seen a title diff --git a/src/termio/message.zig b/src/termio/message.zig index e449960ad..955fa44ed 100644 --- a/src/termio/message.zig +++ b/src/termio/message.zig @@ -130,7 +130,7 @@ pub fn MessageData(comptime Elem: type, comptime small_size: comptime_int) type // If it fits in our small request, do that. if (data.len <= Small.Max) { var buf: Small.Array = undefined; - std.mem.copy(Elem, &buf, data); + @memcpy(buf[0..data.len], data); return Self{ .small = .{ .data = buf,