aboutsummaryrefslogtreecommitdiff
path: root/src/allocators.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-09-04 04:50:47 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-09-04 04:50:47 -0700
commit4f7ff6db2c393b0106260ca786172a1d8f1ea1ac (patch)
treeed2d5b712c268deaf92bc6b613df1c16171650d0 /src/allocators.zig
parent0045fc36d6188d21c8999073e98e8c048f5571e9 (diff)
downloadbun-4f7ff6db2c393b0106260ca786172a1d8f1ea1ac.tar.gz
bun-4f7ff6db2c393b0106260ca786172a1d8f1ea1ac.tar.zst
bun-4f7ff6db2c393b0106260ca786172a1d8f1ea1ac.zip
Fixed memory leaks, but SSR is slower. Should move cleanup & restart steps to a real idle timeout
Former-commit-id: 9499ee3109cb336deb9380f0190631a30c9da51c
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];
}