Compare commits
No commits in common. "7097334201a80fd6cd579ef7991dd7d5437a8575" and "77cceab2886f2b117b4ee4683323067a12ef9fe5" have entirely different histories.
7097334201
...
77cceab288
3 changed files with 5 additions and 14 deletions
|
@ -179,20 +179,17 @@ pub const Image = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn close(self: *Image) void {
|
pub fn close(self: *Image) void {
|
||||||
|
self.allocator.free(self.path);
|
||||||
|
self.allocator.free(self.curpath);
|
||||||
|
|
||||||
var st: i32 = c.sf_close(self.sndfile);
|
var st: i32 = c.sf_close(self.sndfile);
|
||||||
|
|
||||||
if (st != 0) {
|
if (st != 0) {
|
||||||
std.debug.warn("Failed to close {} ({})\n", .{
|
std.debug.warn("Failed to close {} ({})\n", .{
|
||||||
self.path,
|
self.path,
|
||||||
c.sf_error_number(st),
|
c.sf_error_number(st),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
self.allocator.free(self.path);
|
|
||||||
self.allocator.free(self.curpath);
|
|
||||||
|
|
||||||
var allocator = self.allocator;
|
|
||||||
self.* = undefined;
|
|
||||||
allocator.destroy(self);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn read(self: *Image, file_chans: c_int, buf: []f32) bool {
|
pub fn read(self: *Image, file_chans: c_int, buf: []f32) bool {
|
||||||
|
|
|
@ -231,12 +231,7 @@ pub fn doRepl(allocator: *std.mem.Allocator, args_it: anytype) !void {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() !void {
|
pub fn main() !void {
|
||||||
// const allocator = std.heap.page_allocator;
|
const allocator = std.heap.page_allocator;
|
||||||
var allocator_instance = std.heap.GeneralPurposeAllocator(.{}){};
|
|
||||||
defer {
|
|
||||||
_ = allocator_instance.deinit();
|
|
||||||
}
|
|
||||||
const allocator = &allocator_instance.allocator;
|
|
||||||
|
|
||||||
var lang = langs.Lang.init(allocator);
|
var lang = langs.Lang.init(allocator);
|
||||||
defer lang.deinit();
|
defer lang.deinit();
|
||||||
|
|
|
@ -108,7 +108,6 @@ pub const Runner = struct {
|
||||||
// we don't copy load_path into a temporary file because we're already
|
// we don't copy load_path into a temporary file because we're already
|
||||||
// loading it under the SFM_READ mode, which won't cause any destructive
|
// loading it under the SFM_READ mode, which won't cause any destructive
|
||||||
// operations on the file.
|
// operations on the file.
|
||||||
if (self.image) |image| image.close();
|
|
||||||
self.image = try Image.open(self.allocator, load_path);
|
self.image = try Image.open(self.allocator, load_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue