mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
address latest zig changes
This commit is contained in:
@ -78,7 +78,7 @@ pub const LoadingImage = struct {
|
||||
|
||||
if (comptime builtin.os.tag != .windows) {
|
||||
if (std.mem.indexOfScalar(u8, buf[0..size], 0) != null) {
|
||||
// std.os.realpath *asserts* that the path does not have
|
||||
// std.posix.realpath *asserts* that the path does not have
|
||||
// internal nulls instead of erroring.
|
||||
log.warn("failed to get absolute path: BadPathName", .{});
|
||||
return error.InvalidData;
|
||||
@ -86,7 +86,7 @@ pub const LoadingImage = struct {
|
||||
}
|
||||
|
||||
var abs_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
||||
const path = std.os.realpath(buf[0..size], &abs_buf) catch |err| {
|
||||
const path = std.posix.realpath(buf[0..size], &abs_buf) catch |err| {
|
||||
log.warn("failed to get absolute path: {}", .{err});
|
||||
return error.InvalidData;
|
||||
};
|
||||
@ -151,7 +151,7 @@ pub const LoadingImage = struct {
|
||||
if (!isPathInTempDir(path)) return error.TemporaryFileNotInTempDir;
|
||||
}
|
||||
defer if (medium == .temporary_file) {
|
||||
std.os.unlink(path) catch |err| {
|
||||
std.posix.unlink(path) catch |err| {
|
||||
log.warn("failed to delete temporary file: {}", .{err});
|
||||
};
|
||||
};
|
||||
@ -209,7 +209,7 @@ pub const LoadingImage = struct {
|
||||
// The temporary dir is sometimes a symlink. On macOS for
|
||||
// example /tmp is /private/var/...
|
||||
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
||||
if (std.os.realpath(dir, &buf)) |real_dir| {
|
||||
if (std.posix.realpath(dir, &buf)) |real_dir| {
|
||||
if (std.mem.startsWith(u8, path, real_dir)) return true;
|
||||
} else |_| {}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ const Allocator = std.mem.Allocator;
|
||||
const ArenaAllocator = std.heap.ArenaAllocator;
|
||||
const assert = std.debug.assert;
|
||||
const testing = std.testing;
|
||||
const posix = std.posix;
|
||||
const fastmem = @import("../fastmem.zig");
|
||||
const color = @import("color.zig");
|
||||
const sgr = @import("sgr.zig");
|
||||
@ -113,15 +114,15 @@ pub const Page = struct {
|
||||
// anonymous mmap is guaranteed on Linux and macOS to be zeroed,
|
||||
// which is a critical property for us.
|
||||
assert(l.total_size % std.mem.page_size == 0);
|
||||
const backing = try std.os.mmap(
|
||||
const backing = try posix.mmap(
|
||||
null,
|
||||
l.total_size,
|
||||
std.os.PROT.READ | std.os.PROT.WRITE,
|
||||
posix.PROT.READ | posix.PROT.WRITE,
|
||||
.{ .TYPE = .PRIVATE, .ANONYMOUS = true },
|
||||
-1,
|
||||
0,
|
||||
);
|
||||
errdefer std.os.munmap(backing);
|
||||
errdefer posix.munmap(backing);
|
||||
|
||||
const buf = OffsetBuf.init(backing);
|
||||
return initBuf(buf, l);
|
||||
@ -170,7 +171,7 @@ pub const Page = struct {
|
||||
/// this if you allocated the backing memory yourself (i.e. you used
|
||||
/// initBuf).
|
||||
pub fn deinit(self: *Page) void {
|
||||
std.os.munmap(self.memory);
|
||||
posix.munmap(self.memory);
|
||||
self.* = undefined;
|
||||
}
|
||||
|
||||
@ -310,15 +311,15 @@ pub const Page = struct {
|
||||
/// using the page allocator. If you want to manage memory manually,
|
||||
/// use cloneBuf.
|
||||
pub fn clone(self: *const Page) !Page {
|
||||
const backing = try std.os.mmap(
|
||||
const backing = try posix.mmap(
|
||||
null,
|
||||
self.memory.len,
|
||||
std.os.PROT.READ | std.os.PROT.WRITE,
|
||||
posix.PROT.READ | posix.PROT.WRITE,
|
||||
.{ .TYPE = .PRIVATE, .ANONYMOUS = true },
|
||||
-1,
|
||||
0,
|
||||
);
|
||||
errdefer std.os.munmap(backing);
|
||||
errdefer posix.munmap(backing);
|
||||
return self.cloneBuf(backing);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user