less memory thrashing
This commit is contained in:
@@ -28,6 +28,7 @@ pub fn pack(allocator: Allocator, input: [][*:0]const u8) Error![]const u8 {
|
||||
|
||||
const size = c.cmph_packed_size(hash);
|
||||
var buf = try allocator.alloc(u8, size);
|
||||
errdefer allocator.free(buf);
|
||||
c.cmph_pack(hash, &buf[0]);
|
||||
c.cmph_destroy(hash);
|
||||
return buf[4..];
|
||||
|
||||
Reference in New Issue
Block a user