Skip to content

Commit

Permalink
Merge pull request #6 from scrubbs/master
Browse files Browse the repository at this point in the history
deallocate pointer to bytes
  • Loading branch information
cxa authored Nov 16, 2020
2 parents 16fda8d + ecf81be commit 013fc46
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Sources/Piz/Piz.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

/// A simple unzipper.
public struct Piz {
public class Piz {
/// Zip data.
public let data: Data

Expand All @@ -21,13 +21,17 @@ public struct Piz {
_bytes = bytes
_cdirs = dirs
}

deinit {
_bytes.deallocate()
}

/// Creates an instance from `fileURL`.
public init?(fileURL: URL) {
public convenience init?(fileURL: URL) {
guard let data = try? Data(contentsOf: fileURL) else { return nil }
self.init(data: data)
}

private let _bytes: UnsafePointer<UInt8>
private let _cdirs: [String: CDir]
}
Expand Down

0 comments on commit 013fc46

Please sign in to comment.