mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-18 09:46:07 +03:00
pkg/macos: use new @ptrcast for os.log
This commit is contained in:
@ -8,10 +8,10 @@ pub const Log = opaque {
|
|||||||
subsystem: [:0]const u8,
|
subsystem: [:0]const u8,
|
||||||
category: [:0]const u8,
|
category: [:0]const u8,
|
||||||
) *Log {
|
) *Log {
|
||||||
return @as(?*Log, @ptrFromInt(@intFromPtr(c.os_log_create(
|
return @ptrCast(c.os_log_create(
|
||||||
subsystem.ptr,
|
subsystem.ptr,
|
||||||
category.ptr,
|
category.ptr,
|
||||||
)))).?;
|
).?);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn release(self: *Log) void {
|
pub fn release(self: *Log) void {
|
||||||
@ -32,7 +32,11 @@ pub const Log = opaque {
|
|||||||
comptime format: []const u8,
|
comptime format: []const u8,
|
||||||
args: anytype,
|
args: anytype,
|
||||||
) void {
|
) void {
|
||||||
const str = nosuspend std.fmt.allocPrintZ(alloc, format, args) catch return;
|
const str = nosuspend std.fmt.allocPrintZ(
|
||||||
|
alloc,
|
||||||
|
format,
|
||||||
|
args,
|
||||||
|
) catch return;
|
||||||
defer alloc.free(str);
|
defer alloc.free(str);
|
||||||
zig_os_log_with_type(self, typ, str.ptr);
|
zig_os_log_with_type(self, typ, str.ptr);
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ pub fn run(
|
|||||||
build_config.bundle_id,
|
build_config.bundle_id,
|
||||||
macos.os.signpost.Category.points_of_interest,
|
macos.os.signpost.Category.points_of_interest,
|
||||||
);
|
);
|
||||||
const id = macos.os.signpost.Id.generate(log);
|
const id = macos.os.signpost.Id.forPointer(log, self.ptr);
|
||||||
macos.os.signpost.intervalBegin(log, id, signpost_name);
|
macos.os.signpost.intervalBegin(log, id, signpost_name);
|
||||||
break :macos .{ .log = log, .id = id };
|
break :macos .{ .log = log, .id = id };
|
||||||
} else {};
|
} else {};
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const builtin = @import("builtin");
|
||||||
const benchmark = @import("benchmark/main.zig");
|
const benchmark = @import("benchmark/main.zig");
|
||||||
|
|
||||||
pub const main = benchmark.cli.main;
|
pub const main = benchmark.cli.main;
|
||||||
|
Reference in New Issue
Block a user