pkg/macos: use new @ptrcast for os.log
parent
b8f5cf9d52
commit
d30771ecff
|
|
@ -8,10 +8,10 @@ pub const Log = opaque {
|
|||
subsystem: [:0]const u8,
|
||||
category: [:0]const u8,
|
||||
) *Log {
|
||||
return @as(?*Log, @ptrFromInt(@intFromPtr(c.os_log_create(
|
||||
return @ptrCast(c.os_log_create(
|
||||
subsystem.ptr,
|
||||
category.ptr,
|
||||
)))).?;
|
||||
).?);
|
||||
}
|
||||
|
||||
pub fn release(self: *Log) void {
|
||||
|
|
@ -32,7 +32,11 @@ pub const Log = opaque {
|
|||
comptime format: []const u8,
|
||||
args: anytype,
|
||||
) 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);
|
||||
zig_os_log_with_type(self, typ, str.ptr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ pub fn run(
|
|||
build_config.bundle_id,
|
||||
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);
|
||||
break :macos .{ .log = log, .id = id };
|
||||
} else {};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const benchmark = @import("benchmark/main.zig");
|
||||
|
||||
pub const main = benchmark.cli.main;
|
||||
|
|
|
|||
Loading…
Reference in New Issue