Zig 0.17.0-dev (Split by item)
This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig library itself.
Zig › std/ › crypto/ › Certificate/ › Bundle/ › macos.zig › rescanMac
rescanMac
macos.rescanMac
pub fn rescanMac (cb : *Bundle , gpa : Allocator , io : Io , now : Io .Timestamp ) RescanMacError !void
File
Code
pub fn rescanMac (cb : *Bundle , gpa : Allocator , io : Io , now : Io .Timestamp ) RescanMacError !void {
cb .bytes .clearRetainingCapacity ();
cb .map .clearRetainingCapacity ();
const keychain_paths = [2 ][]const u8 {
"/System/Library/Keychains/SystemRootCertificates.keychain" ,
"/Library/Keychains/System.keychain" ,
};
for (keychain_paths ) |keychain_path | {
const bytes = Io .Dir .cwd ().readFileAlloc (io , keychain_path , gpa , .limited (std .math .maxInt (u32 ))) catch |err | switch (err ) {
error .StreamTooLong => return error .FileTooBig ,
else => |e | return e ,
};
defer gpa .free (bytes );
var reader : Io .Reader = .fixed (bytes );
scanReader (cb , gpa , &reader , now .toSeconds ()) catch |err | switch (err ) {
error .ReadFailed => unreachable ,
else => |e | return e ,
};
}
cb .bytes .shrinkAndFree (gpa , cb .bytes .items .len );
}