Fix
This commit is contained in:
parent
557e4ab064
commit
bead52df5a
@ -200,11 +200,11 @@ pub const FileEngine = struct {
|
|||||||
|
|
||||||
// Deinit the struct array before creating a new one
|
// Deinit the struct array before creating a new one
|
||||||
for (self.struct_array) |*elem| elem.deinit();
|
for (self.struct_array) |*elem| elem.deinit();
|
||||||
self.allocator(self.struct_array);
|
self.allocator.free(self.struct_array);
|
||||||
|
|
||||||
var struct_array = std.ArrayList(SchemaStruct).init(self.allocator);
|
var struct_array = std.ArrayList(SchemaStruct).init(self.allocator);
|
||||||
parser.parse(&struct_array) catch return error.SchemaNotConform;
|
parser.parse(&struct_array) catch return error.SchemaNotConform;
|
||||||
self.struct_array = struct_array.toOwnedSlice();
|
self.struct_array = struct_array.toOwnedSlice() catch return FileEngineError.MemoryError;
|
||||||
|
|
||||||
const path = std.fmt.allocPrint(self.allocator, "{s}/DATA", .{self.path_to_ZipponDB_dir}) catch return FileEngineError.MemoryError;
|
const path = std.fmt.allocPrint(self.allocator, "{s}/DATA", .{self.path_to_ZipponDB_dir}) catch return FileEngineError.MemoryError;
|
||||||
defer self.allocator.free(path);
|
defer self.allocator.free(path);
|
||||||
|
@ -174,7 +174,7 @@ pub fn main() !void {
|
|||||||
.expect_path_to_new_db => switch (token.tag) {
|
.expect_path_to_new_db => switch (token.tag) {
|
||||||
.identifier => {
|
.identifier => {
|
||||||
file_engine.deinit();
|
file_engine.deinit();
|
||||||
file_engine = FileEngine.init(allocator, try allocator.dupe(u8, toker.getTokenSlice(token)));
|
file_engine = try FileEngine.init(allocator, try allocator.dupe(u8, toker.getTokenSlice(token)));
|
||||||
file_engine.checkAndCreateDirectories() catch |err| {
|
file_engine.checkAndCreateDirectories() catch |err| {
|
||||||
send("Error: Coulnt create database directories: {any}", .{err});
|
send("Error: Coulnt create database directories: {any}", .{err});
|
||||||
state = .end;
|
state = .end;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user