~gpanders/ztags

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH] Make some vars consts

Details
Message ID
<CX0KI95W2NG0.3TV400H2UUP14@gpanders.com>
DKIM signature
missing
Download raw message
Patch: +3 -3
---
 src/Tags.zig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/Tags.zig b/src/Tags.zig
index eb6c69e..c86d924 100644
--- a/src/Tags.zig
+++ b/src/Tags.zig
@@ -107,7 +107,7 @@ pub fn deinit(self: *Tags) void {
/// allocates, and is slower, but is only temporary until a cross-platform "map file" function
/// exists in the stdlib (or until someone implements it here)).
fn mapFile(allocator: std.mem.Allocator, fname: []const u8) !?[:0]const u8 {
    var file = try std.fs.cwd().openFile(fname, .{});
    const file = try std.fs.cwd().openFile(fname, .{});
    defer file.close();

    const metadata = try file.metadata();
@@ -122,13 +122,13 @@ fn mapFile(allocator: std.mem.Allocator, fname: []const u8) !?[:0]const u8 {

    switch (@import("builtin").os.tag) {
        .windows => {
            var array_list = try std.ArrayList(u8).initCapacity(allocator, size + 1);
            const array_list = try std.ArrayList(u8).initCapacity(allocator, size + 1);
            defer array_list.deinit();
            try file.reader().readAllArrayList(&array_list, size + 1);
            return try array_list.toOwnedSliceSentinel(0);
        },
        else => {
            var mapped = try std.os.mmap(null, size, std.os.PROT.READ, std.os.MAP.SHARED, file.handle, 0);
            const mapped = try std.os.mmap(null, size, std.os.PROT.READ, std.os.MAP.SHARED, file.handle, 0);
            return @ptrCast(mapped);
        },
    }

base-commit: 6cdbd6dcdeda0d1ab9ad30261000e3d21b2407e6
-- 
2.42.1
Reply to thread Export thread (mbox)