aboutsummaryrefslogtreecommitdiff
path: root/src/allocators.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/allocators.zig')
-rw-r--r--src/allocators.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/allocators.zig b/src/allocators.zig
index 29f660a12..4150a37c8 100644
--- a/src/allocators.zig
+++ b/src/allocators.zig
@@ -685,6 +685,10 @@ pub fn BSSMap(comptime ValueType: type, comptime count: anytype, store_keys: boo
slice = try self.map.allocator.dupe(u8, key);
}
+ if (comptime remove_trailing_slashes) {
+ slice = constStrToU8(std.mem.trimRight(u8, slice, "/"));
+ }
+
if (!result.index.is_overflow) {
key_list_slices[result.index.index] = slice;
} else {
@@ -945,6 +949,6 @@ pub fn TBSSMap(comptime ValueType: type, comptime count: anytype, store_keys: bo
};
}
-pub fn constStrToU8(s: []const u8) []u8 {
+pub inline fn constStrToU8(s: []const u8) []u8 {
return @intToPtr([*]u8, @ptrToInt(s.ptr))[0..s.len];
}