From 9fa6f2545923809fcc852bb4b1a576d3877a14a4 Mon Sep 17 00:00:00 2001 From: MrBounty Date: Sat, 9 Nov 2024 16:39:40 +0100 Subject: [PATCH] Removed CSV_DELIMITER and some old comment --- src/config.zig | 3 +-- src/fileEngine.zig | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/config.zig b/src/config.zig index fd122ff..85ae389 100644 --- a/src/config.zig +++ b/src/config.zig @@ -1,6 +1,5 @@ pub const BUFFER_SIZE = 1024 * 64 * 64; // Line limit when parsing file and other buffers -pub const MAX_FILE_SIZE = 5e+6; // 5Mb -pub const CSV_DELIMITER = ';'; // TODO: Delete +pub const MAX_FILE_SIZE = 5e+8; // 500Mb pub const CPU_CORE = 16; // Testing diff --git a/src/fileEngine.zig b/src/fileEngine.zig index 9eff8d8..dfea609 100644 --- a/src/fileEngine.zig +++ b/src/fileEngine.zig @@ -32,7 +32,6 @@ const FileEngineError = @import("stuffs/errors.zig").FileEngineError; const config = @import("config.zig"); const BUFFER_SIZE = config.BUFFER_SIZE; const MAX_FILE_SIZE = config.MAX_FILE_SIZE; -const CSV_DELIMITER = config.CSV_DELIMITER; const RESET_LOG_AT_RESTART = config.RESET_LOG_AT_RESTART; const CPU_CORE = config.CPU_CORE; @@ -42,7 +41,6 @@ const FileEngineState = enum { MissingPath, MissingSchema, Ok }; /// Manage everything that is relate to read or write in files /// Or even get stats, whatever. If it touch files, it's here -/// TODO: Keep all struct dir in a haspmap so I dont need to use an allocPrint everytime pub const FileEngine = struct { allocator: Allocator, path_to_ZipponDB_dir: []const u8, @@ -51,7 +49,7 @@ pub const FileEngine = struct { state: FileEngineState, pub fn init(allocator: Allocator, path: []const u8) ZipponError!FileEngine { - var schema_buf = allocator.alloc(u8, BUFFER_SIZE) catch return FileEngineError.MemoryError; // TODO: Use a list + var schema_buf = allocator.alloc(u8, BUFFER_SIZE) catch return FileEngineError.MemoryError; defer allocator.free(schema_buf); const len: usize = FileEngine.readSchemaFile(path, schema_buf) catch 0; @@ -1127,7 +1125,7 @@ pub const FileEngine = struct { for (all_struct_member) |mn| { if (std.mem.eql(u8, mn, "id")) continue; - if (map.contains(mn)) count += 1 else writer.print(" {s},", .{mn}) catch return FileEngineError.WriteError; // TODO: Handle missing print better + if (map.contains(mn)) count += 1 else writer.print(" {s},", .{mn}) catch return FileEngineError.WriteError; } return ((count == all_struct_member.len - 1) and (count == map.count()));