1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

crypto.pem: add Block.free() method (#17045)

This commit is contained in:
MatejMagat305 2023-01-20 09:49:45 +01:00 committed by GitHub
parent fed6524803
commit 25f1b713aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,6 +62,19 @@ pub mut:
data []u8
}
// free the resources taken by the Block `block`
[unsafe]
pub fn (mut block Block) free() {
$if prealloc {
return
}
unsafe {
block.block_type.free()
block.headers.free()
block.data.free()
}
}
// returns a new `Block` with the specified block_type
[inline]
pub fn new(block_type string) Block {