clean up some debug prints

- free file and command memory on exit
This commit is contained in:
Luna 2019-07-10 12:13:44 -03:00
parent 16a082ce0a
commit 2b2eb51dff
2 changed files with 8 additions and 6 deletions

View File

@ -195,7 +195,7 @@ pub const Image = struct {
var idx = c.lilv_port_get_index(ctx.plugin, port);
std.debug.warn(
"sym={}, idx={} to val={}\n",
"\tset sym={}, idx={} to val={}\n",
param.sym,
idx,
param.value,
@ -223,10 +223,10 @@ pub const Image = struct {
const file_end = try getEndPos(self.curpath);
const seek_pos = position.seekPos(file_end);
std.debug.warn("start {} end {}\n", seek_pos.start, seek_pos.end);
std.debug.warn("\tstart {} end {}\n", seek_pos.start, seek_pos.end);
var seeked = c.sf_seek(self.sndfile, 0, c.SEEK_SET);
std.debug.warn("in: seek {}\n", seeked);
// make sure we start from 0
_ = c.sf_seek(self.sndfile, 0, c.SEEK_SET);
var i: usize = 0;

View File

@ -21,16 +21,18 @@ pub fn main() !void {
// args[1] is the path to scri file
const scri_path = try (args_it.next(allocator) orelse @panic("expected scri path"));
std.debug.warn("path: '{}'\n", scri_path);
var file = try std.fs.File.openRead(scri_path);
defer file.close();
// sadly, we read it all into memory. such is life
const total_bytes = try file.getEndPos();
var data = try allocator.alloc(u8, total_bytes);
defer allocator.free(data);
_ = try file.read(data);
var cmds = try lang.parse(data);
defer cmds.deinit();
try runner.runCommands(cmds, true);
}