Files
2024-12-01 22:38:51 -05:00

29 lines
775 B
Swift

//
// CHelpers.swift
// Supersign
//
// Created by Kabir Oberai on 13/10/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
//
import Foundation
import CSupersign
package var stdoutSafe: UnsafeMutablePointer<FILE> {
get_stdout()
}
extension Data {
init?(deallocator: Deallocator = .free, acceptor: (inout Int) -> UnsafeMutableRawPointer?) {
var count = 0
guard let bytes = acceptor(&count) else { return nil }
self.init(bytesNoCopy: bytes, count: count, deallocator: deallocator)
}
init(deallocator: Deallocator = .free, acceptor: (inout Int) -> UnsafeMutableRawPointer) {
var count = 0
let bytes = acceptor(&count)
self.init(bytesNoCopy: bytes, count: count, deallocator: deallocator)
}
}